如何检查了XML是什么在Web服务请求发送? [英] How to check what xml is sent during web service request?

查看:131
本文介绍了如何检查了XML是什么在Web服务请求发送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让这些由.NET SOAP请求生成的原始XML。我不知道该怎么问这个precisely,但在这里不用

Is there a way to get raw XML which is generated by SOAP request in .net. I don't know how to ask this precisely, but here goes

我添加Web引用,并调用一些方法。有没有办法知道XML被发送。仅用于调试,所以快速和肮脏的方法是不够

I add web reference and call some method. Is there a way to know what XML is being sent. For debugging purposes only, so quick and dirty way is enough

P.S。 使用SSL,所以剪断并没有任何帮助,

P.S. SSL is used, so snipping doesn't help here

推荐答案

您可以创建一个SoapExtensionAttribute并将其应用到您的Web服务的方法。

You can create a SoapExtensionAttribute and apply it to your web service methods.

创建一个从SoapExtensionAttribute派生的类。

Create a class that is derived from SoapExtensionAttribute.

创建另一个类从SoapExtension派生。

Create another class that derives from SoapExtension.

您SoapExtensionAttribute的类型应该是你的SoapExtension的类型。

The Type of your SoapExtensionAttribute should be the type of your SoapExtension.

在你在的SoapExtension,您可以访问的时刻,该数据已被序列化/反序列化。

Once you're in the SoapExtension, you have access to the moment where the data has been serialize/deserialized.

下面是4特定阶段:

SoapMessageStage.BeforeSerialize
SoapMessageStage.AfterSerialize           *
SoapMessageStage.BeforeDeserialize        *
SoapMessageStage.AfterDeserialize

与那些在*是,你要访问的流阶段。 从那里,你可以记录所得到的XML进出你的网络服务。

The ones with the '*' are the stages where you want to access the stream. From there, you can log the xml that gets in and out of you web service.

这就是我们在这里做的,它完美的作品。

That's what we do here, it works perfectly.

下面的解释更详细信息的链接: http://progtutorials.tripod.com/soapext.htm

Here's a link that explains more in details: http://progtutorials.tripod.com/soapext.htm

希望这一直是一定的帮助。

Hope that have been of some help.

这篇关于如何检查了XML是什么在Web服务请求发送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆