Using Insomnia To Make Soap Calls

efultz picture efultz · Jan 13, 2020 · Viewed 8.4k times · Source

I am trying to use Insomnia to make soap calls - specifically trying to get post to succeed. I defined the URL as the end point and put the body type as XML with the SOAP contents (envelope, header, body). I defined the user id and password in the header. When I run I get 415 Unsupported Media Type. I can't really paste the soap contents because of all of the URL addressing in the envelope. I am using Insomnia to succeed in doing the REST call to get my information (for some crazy reason the gets are REST but the posts are SOAP) but can't get the insert to work. Is there something special I need, or does Insomnia not support SOAP post transactions? I googled and it appears in 2018 this was added. I don't have the WSDL available.

I appreciate this is not giving lots of information so guidance on what more I may provide to get assistance will also be helpful. Has anyone succeeded in using Insomnia to make SOAP calls?

Answer

Sebastian picture Sebastian · Feb 28, 2020

All that was needed for me to make it work was:

  • Request method: POST.
  • Setting the Content-Type header to text/xml; charset=utf-8 (application/xml gave me the 415 response).
  • Wrapping request body in proper SOAP envelope.

You should be able to call GET on YourHandler.asmx to look up envelopes for requests you want to use. Envelope should look somewhat like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/">
      <foo>
        <Id>1</Id>
        <Name>Bar</Name>
      </foo>
    </HelloWorld>
  </soap:Body>
</soap:Envelope>

Credits for the guidance and envelope sample goes to this answer.