I have a .net web-service hosted in IIS 6.0 that periodically fails with an http 500 because a client connects to it with data that does not match the wsdl.
Things like having an element specified in a method as being of type int and the inbound xml element contains a decimal number.
WSDL element definition:
<s:element minOccurs="1" maxOccurs="1" form="unqualified" name="ItemCount" type="s:int" />
provided element:
<ItemCount>1.0</ItemCount>
This leaves a 500 error in the iis logs but no information of the soap fault returned or the input data that caused the error.
Currently I have diagnosed several problems with data provided by capturing everything using wireshark but I'd like to know of other options that a perhaps less intrusive.
Is there any way of capturing the data being sent that is causing the 500 errors (hopefully ONLY capturing the data when the 500 occurs)? Possibly by:
- Configuring IIS
- Configuring the web-service
- Changing the code of the web-service
EDIT after testing answer provided by tbreffni
The answer that best fitted what I was after tbreffni's - there were several other good responses but the answer allows capture of the payload causing deserialization errors without running something like fiddler or wireshark.
Info on actually getting a SOAP extension to run is a little light so I've included below the steps I found necessary:
- Build the SOAP extension as a .dll as per the MSDN article
- Add the .dll to the bin directory for the service to trace
- In the web.config of the service to trace add the following to the webServices section, replacing the SOAPTraceExtension.TraceExtension and SOAPTraceExtension to match your extension.
<webServices>
<soapExtensionTypes>
<add type="SOAPTraceExtension.TraceExtension, SOAPTraceExtension" priority="1" group="0"/>
</soapExtensionTypes>
</webServices>