给我们的应用的“App.exe.config”配置文件添加下面的粗字体:
<configSections>
<section name="microsoft.web.services2"type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<microsoft.web.services2>
<diagnostics>
<trace enabled="true" input="InputTrace.xml" output="OutputTrace.xml" />
<detailedErrors enabled="true" />
</diagnostics>
</microsoft.web.services2>
这样,重启了服务之后,如果有进出的SOAP消息,可以在服务本目录下看到有“InputTrace.xml”和“OutputTrace.xml”。
这两个文件就自动记录了进出的SOAP完整包。
InputTrace.XML的内容示范如下,第一个包就是发送了一个对111的查询请求:
<?xml version="1.0" encoding="utf-8" ?> <log> <soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401 -wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401 -wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <wsa:Action>subscribe</wsa:Action> <wsa:From> <wsa:Address>soap.tcp://10.168.3.16:82/oo</wsa:Address> </wsa:From> <wsa:MessageID>uuid:85a22229-282c-4a66-ae02-571af9285485</wsa:MessageID> <wsa:ReplyTo> <wsa:Address>soap.tcp://10.168.3.16:82/oo</wsa:Address> </wsa:ReplyTo> <wsa:To>soap.tcp://10.168.3.16:90/kk</wsa:To> <wsse:Security> <wsu:Timestamp wsu:Id="Timestamp-d87cb1ae-e28d-4bd7-b77d-3e7d7b634357"> <wsu:Created>2003-04-04T06:41:47Z</wsu:Created> <wsu:Expires>2003-04-04T06:46:47Z</wsu:Expires> </wsu:Timestamp> </wsse:Security> </soap:Header> <soap:Body> <x:register xmlns:x="urn:ClientSubscriptionApp:Subscription"> <name>RequestHandler.RequestRoute</name> </x:register> </soap:Body> </soap:Envelope></log> |
当你调试WSE时,可以启用这个功能,将对你的调试工作起到极大的促进作用!
编写者:郑昀@UltraPower