Monday, December 12, 2016

C# SOAP service call and an empty SOAPAction header

Working with a third party service, one of the methods tested okay when using SoapUI, however whenever called via .NET code it would return a 500 error.

Looking at the WSDL, the method required a soap action of "", literally an empty string. So using fiddler I was able to see the request made in SoapUI and code, and discovered that the .NET code was sending the soap action header as null and not an empty string.


To fix this I used the following line to correctly set the soap action in .NET:
webRequest.Headers.Add("SOAPAction", "\"\"");
It started to work as expected.

No comments:

Post a Comment