开发者

Dump of returned data from webservice in .NET

开发者 https://www.devze.com 2022-12-17 03:08 出处:网络
I have a web service client in C# where I take the object returned by the webservice and pass it on to the following method in order to create an xml file:

I have a web service client in C# where I take the object returned by the webservice and pass it on to the following method in order to create an xml file:

XmlSerializer s = new XmlSerializer(typeof(T));
TextWriter sw = new StreamWriter(filename);
s.Serialize(sw, obj)开发者_Python百科;
sw.Close();

However, there are fields that the webservice side claims to send while the resulting xml does not contain these (IU have done 'update service' in VS...). Is there a way to get a dump of the data that the webclient receives at a lower level?


Two very good options:

  • Wireshark - a network tracer, basically
  • Fiddler - a proxy which records the requests and responses, and displays things nicely

Wireshark is less invasive than Fiddler as it doesn't change anything that the client does, but Fiddler has support for HTTPS so long as you can persuade your client to accept its certificate (it's effectively a man-in-the-middle attack as far as the protocol is concerned - but Fiddler is the man in the middle).

Additionally I'm pretty sure you could add SOAP filters etc within .NET to log what goes in and out - but the nice thing about Wireshark and Fiddler is that they're separate from your process, so you can be absolutely sure that the results haven't been messed around with by anything in your code or configuration.


You could also use Http Analyzer to capture HTTP transport.


You could to use Fiddler to get that dump, if you're using a HTTP transport.


If you are using Visual Studio and you have the Web Reference in your project, you can choose to show all files and there you will see all the proxy classes and datasources, which could give you quite a hint to see what kind of structure the data has.

To see the data itself, the best is to use some sniffing mechanism, the easiest which I like is the Firebug plugin in the Firefox if you are calling the service directly or maybe some general HTTP sniffer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号