I'm trying to trouble shoot a web service client in my current project. I'm not sure of the platform of the Service Server (Most likely LAMP). I believe there is a fault on their side of the fence as i have eliminated the potential issues with my client. The client is a standard ASMX type web reference proxy auto generated from the service WSDL.
What I need to get to is the RAW SOAP Messages (Request and Responses)
What is the best way to go about this?
I made following changes in
web.config
to get the SOAP (Request/Response) Envelope. This will output all of the raw SOAP information to the filetrace.log
.Try Fiddler2 it will let you inspect the requests and response. It might be worth noting that Fiddler works with both http and https traffic.
Not sure why all the fuss with web.config or a serializer class. The below code worked for me:
You can implement a SoapExtension that logs the full request and response to a log file. You can then enable the SoapExtension in the web.config, which makes it easy to turn on/off for debugging purposes. Here is an example that I have found and modified for my own use, in my case the logging was done by log4net but you can replace the log methods with your own.
You then add the following section to your web.config where YourNamespace and YourAssembly point to the class and assembly of your SoapExtension:
You haven't specified what language you are using but assuming C# / .NET you could use SOAP extensions.
Otherwise, use a sniffer such as Wireshark
I realize I'm quite late to the party, and since language wasn't actually specified, here's a VB.NET solution based on Bimmerbound's answer, in case anyone happens to stumble across this and needs a solution. Note: you need to have a reference to the stringbuilder class in your project, if you don't already.
Simply call the function and it will return a string with the serialized xml of the object you're attempting to pass to the web service (realistically, this should work for any object you care to throw at it too).
As a side note, the replace call in the function before returning the xml is to strip out vbCrLf characters from the output. Mine had a bunch of them within the generated xml however this will obviously vary depending on what you're trying to serialize, and i think they might be stripped out during the object being sent to the web service.