从 WCF 创建客户端查看 SOAP XML
我已按照以下说明使用 SVCUTIL.exe 创建了一个 WCF 客户端: http:// msdn.microsoft.com/en-us/library/ms733133.aspx
它创建一个app.config和一个soapproxy.cs文件以供使用。
我无法找到任何方法来获取原始 XML 以进行调试。
Google 有很多向 web.config 文件添加跟踪扩展的示例,但是我没有 web.config 文件......我找到的示例是针对 web.service 而不是 System.ServiceModel;
我需要访问 XML Soap 调用以便调试它?
更新: 我正在尝试编辑配置跟踪以查看 SOAP XML。
我已将其添加到 app.config 文件中
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="CardSpace">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\log\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
</configuration>
,但是出现的跟踪日志似乎不包含原始 XML
I have created a WCF Client with the SVCUTIL.exe following these instructions : http://msdn.microsoft.com/en-us/library/ms733133.aspx
It creates a app.config and a soapproxy.cs file to use.
I can not figure out any way of getting the raw XML for debugging purposes.
Google has lots of examples with adding a traceextension to the web.config file, however I do not have a web.config file... And the examples I found are for web.service not System.ServiceModel;
I need to access the XML soap calls so I can debug it?
UPDATE:
I am trying to edit the config trace to view the SOAP XML.
I have added this to the app.config file
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="CardSpace">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\log\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
</configuration>
However the trace log that comes up does not seem to include the raw XML
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了快速调试,我使用 WCF 测试客户端。它非常简单,并且可以与 WCF 和 ASMX 服务配合使用。我还使用它来使用用 Java 编写的第三方应用程序(带有 wsdl 定义)的服务。
开始 -> Visual Studio 2010 命令提示符 -> wcftestclient.exe
或
开始 -> Visual Studio 2008 命令提示符 -> wcftestclient.exe
此处的信息:http://msdn.microsoft. com/en-us/library/bb552364.aspx
它能够查看 XML/SOAP 请求和响应。
我还使用 XMLTraceListener。这会在我的应用程序路径中生成跟踪,并且我能够查看整个请求/响应正文。
这是我的 web.Config 部分
For quick debugging I use the WCF Test Client. Its quite simple and works with WCF and ASMX services. I also use it to consume services from third party applications written in Java (with wsdl definitions).
Start -> Visual Studio 2010 Command Prompt -> wcftestclient.exe
or
Start -> Visual Studio 2008 Command Prompt -> wcftestclient.exe
Information here: http://msdn.microsoft.com/en-us/library/bb552364.aspx
This has the ability to view the XML/SOAP request and response.
Also I use the XMLTraceListener. This generates the trace for me inside my application path and I am able to view the entire request/response body.
Here is my web.Config section