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
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 is used, so snipping doesn't help here
I typically do this sort of thing with Fiddler.
Stick this in the config file:-
<system.net>
<defaultProxy enabled="true">
<proxy proxyaddress="http://127.0.0.1:8888" bypassonlocal="False"/>
</defaultProxy>
</system.net>
Fire up fiddler and you should be able to monitor all http traffic coming from your application. Just set enabled to false before closing fiddler.
You can create a SoapExtensionAttribute and apply it to your web service methods.
Create a class that is derived from SoapExtensionAttribute.
Create another class that derives from SoapExtension.
The Type of your SoapExtensionAttribute should be the type of your SoapExtension.
Once you're in the SoapExtension, you have access to the moment where the data has been serialize/deserialized.
Here are the 4 specific stage:
SoapMessageStage.BeforeSerialize
SoapMessageStage.AfterSerialize *
SoapMessageStage.BeforeDeserialize *
SoapMessageStage.AfterDeserialize
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.
Here's a link that explains more in details: http://progtutorials.tripod.com/soapext.htm
Hope that have been of some help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With