While it’s true that JSON or XML has been the rage for a long time in web services, there are still thousands and thousands of SOAP services in most companies I walk across.
Today I had to do some tests with a super simple example with WCF (in fact, the one that comes with the Visual Studio WCF template) and the truth is that I spent a while until I was able to access the service from Postman or Fiddler correctly. The fact is that I have tried with WCF Test client, which comes as part of Visual Studio and it worked without problems.
But when I got to Postman, all I got was a 400 — Bad Request error without much explanation.
And in Fiddler exactly the same!
After wandering around for a while, I uploaded my service to a Web App in Microsoft Azure and tried one of the many pages that act as a SOAP client, reading from your service definition (WSDL), and that’s where I was able to see what was missing from my request to make it work just as well as in WCF Test Client: the SOAPAction header, plus a correct Content-Length in the case of Postman. In such a way that the configuration to be able to make the call would be the following:
These would be the headers needed to make the request:
and this is the body of the message:
For Fiddler they would be the same values but in their format:
An additional point to review is that Postman does not calculate the Content-Length automatically as Fiddler does and this can also cause problems when making the request. You can use a page like this (or Fiddler that calculates the content length and updates it by itself) to calculate the size of the content and save you a few more minutes.
Top comments (0)