灵魂-放水

为学日益,为道日损。

BlogJava 首页 新随笔 联系 聚合 管理
  296 Posts :: 10 Stories :: 274 Comments :: 0 Trackbacks
     cnblogs里有篇帖子http://idior.cnblogs.com/articles/436801.htmlApplied WSE 3.0 to Web Service Project ),对于学习WS-Addressing是篇不错的帖子。按照此贴的方法进行,在追踪Soap消息时,抛出异常。在未开启Client端WSE功能时,Soap Toolkit 3.0能追踪到soap消息,而且,response显示了wse的特性。

   
      为了使用Soap Toolkit 3.0,我们在WS client端输入的目标地址为:http://localhost:8080/WSEWebService/Service.asmx
      Soap Toolkit 3.0设置为:
       
       Listen
       Local port:8080

       Forward to
       Destination:localhost
       Destination:80
       之所以这样设置,因为在IIS里设置的本机Web Services为:http://localhost:80/WSEWebService/Service.asmx。Soap Toolkit 在8080端口监听来自client端的消息,并将消息递交到IIS监听的80端口。

       可当开启client端wse功能时,抛出如下异常:

Microsoft.Web.Services3.Addressing.AddressingFault: Destination Unreachable ---> System.Exception:

WSE816:

The <To> header must match the value of an incoming message's HTTP Request Url if the soap receiver does not have an actor name.

The <To> header received contained "http://localhost:8080/WSEWebService/Service.asmx"

while the HTTP Request Url was "http://localhost/WSEWebService/Service.asmx".


        查看 Soap Toolkit 监听到的SOAP消息可以发现,Request消息的SoapHeader中, 目标地址仍然为<wsa:To>http://localhost:8080/WSEWebService/Service.asmx</wsa:To> ,而不是<wsa:To>http://localhost:80/WSEWebService/Service.asmx</wsa:To>.因此,destination不可达,抛出如上异常。
         在网上查了资料发现:
          “

WS-Addressing moves the destination URL of the message into the message to enable routing and scenarios where messages are delivered over multiple protocols. Before WS-Addressing the URL of the destination was only available in the protocol part of the message. Is you were sending a SOAP message over HTTP, the URL was stored in the HTTP part of the message. You had no access to the URL from within your SOAP processor – unless your Web server vendor chose to give you access to the HTTP headers.

Now with WS-Addressing built into WSE, the Web service platform can actually determine if a message was indeed intended for the service that received it because WSE adds the <to> element to the header of the SOAP message:

      <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

http://MyServer/MyService/Service.asmx</wsa:To>

WSE is actually being smart about the header and rejects messages where the destination in the <wsa:To> header and the URL in the HTTP header do not match.

One unfortunate consequence of this behavior is that you cannot use transparent tracing tools like tcpTrace and MSSoapT for message debugging. These tools act like an intermediary receiver and they do cause the URLs in the <To> header and in the HTTP header to not match.

”,大概意思也就是MSSoapt(Soap Toolkit )不支持WSE中WS-Addressing<wsa:To>。所以在调试WSE提供的特性时,不能再用 tcpTrace或者MSSoapT这样的工具来追踪Soap消息。

         不过,好的消息是,WSE从2.0开始就提供了可以追踪到SOAP消息的诊断工具。


勾选Enable Message Trace,在调试过程中,将生成InputTrace.webinfo和OutputTrace.webinfo文件,里面记录了我们想要的信息,到此,不需要借助其他Trace工具便可追踪到Soap消息。
        
posted on 2008-01-11 10:17 放水老倌 阅读(1425) 评论(0)  编辑  收藏 所属分类: Web Services&SOA

只有注册用户登录后才能发表评论。


网站导航: