.NET 在客户端上记录 Soap 请求
我在客户端应用程序中使用第三方 .NET WebService。 出于调试目的,我想捕获从我的服务器发送的 SOAP 请求。 我该怎么做呢? 这是在 .NET 2.0 上完成的,没有使用 WCF 或 WSE。
I'm consuming a third party .NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on .NET 2.0 without the use of WCF or WSE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不久前写了一篇关于此问题的文章,标题为“在 .NET 中记录 SOAP 消息”。
最简单的方法是使用.NET 已提供的工具。
1.扩展类
SoapExtension
。2. 重写方法
ProcessMessage
以获取 Soap 请求的完整输出,然后将此信息输出到文本文件或事件日志。I wrote a post about this a while ago titled "Logging SOAP Messages in .NET".
The easiest way is to use the tools already provided with .NET.
1. Extend the class
SoapExtension
.2. override the method
ProcessMessage
to get a full output of your Soap Request, then output this information to a text file or event log.如果是出于调试目的,我只需将 Web 请求配置为使用代理并通过 fiddler 发送整个请求(http:// www.fiddlertool.com)然后您就可以准确地看到通过线路传输的内容。
If it's for debugging purposes I'd just configure the web request to use a proxy and send the entire request though fiddler (http://www.fiddlertool.com) then you can see exactly what's getting transmitted over the wire.
您可以使用许多选项。 当然有一些商业工具可以用于此目的(例如 SOAPScope),但如果您只是想捕获请求/响应的原始内容,那么除了 Fiddler(Walden 已经提到过)之外,还有其他几种工具。
就我个人而言,我一直是 Simon Fell 的 TcpTrace 和 YATT。
如果您有兴趣实际检测代码,以便它可以自行完成(例如,通过将所有内容记录到文件或其他内容中),那么您可能需要考虑实现 SoapExtension 在您的服务器上。
There are many options you can use. There are certainly some commercial tools for this (like SOAPScope), but if you're just looking to capture the raw contents of the requests/responses there are several tools out there besides Fiddler (that Walden mentioned already).
Personally, I've been a long time user of Simon Fell's TcpTrace and YATT.
If you're interested in actually instrumenting the code so that it can do it on its own (say, by logging everything to a file or something), then you might want to look into implementing a SoapExtension on your server.
您可以使用 SoapExtension 来记录 Soap 调用。
http://msdn.microsoft.com/en-us/magazine/cc164007。 ASPX
You can use a SoapExtension to log the Soap calls.
http://msdn.microsoft.com/en-us/magazine/cc164007.aspx
我过去使用过Web 服务、SOA 和 SOAP 测试工具 -soapUI,并取得了良好的成功。
-埃杜德
I've used the Web Service, SOA and SOAP Testing Tool - soapUI with good success in the past.
-Edoode
也许wireshark? 我总是使用它来捕获我的应用程序的流量。
Maybe wireshark ? I'm always using it for capturing traffic of my applications.