10

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?

efultz
  • 1,135
  • 2
  • 11
  • 26

2 Answers2

21

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.

Sebastian
  • 243
  • 2
  • 6
  • I'm not sure how standard this is, but I also had to add the `SOAPAction` header to get this to work. – d.breve Aug 26 '22 at 18:05
13

You can import the WSDL file, so that all methods, headers etc. will be created automatically. Click on:

  1. Go to dashboard
  2. Click Create
  3. Choose URL (under import from)
  4. Paste the WSDL URL and click Fetch and Import

As an example you can use the following URL: http://www.dneonline.com/calculator.asmx?wsdl

You will get this: enter image description here


The problem as of writing this answer is, that there are two bugs:

  1. Not all WSDL URLs are getting imported correctly (e.g. this one works in SOAP UI, but not in Insomnia http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL)
  2. The methods are getting imported, but they don't work

You can submit and issue on Github, so that this is getting fixed: https://github.com/Kong/insomnia

sunwarr10r
  • 4,420
  • 8
  • 54
  • 109
  • 1
    Import succeeded but new no new project, request or method was created. – Panu Haaramo Oct 04 '21 at 12:31
  • @PanuHaaramo I just faced the same problem... seems like they kind fixed it (pending for release...) see this issue: https://github.com/Kong/insomnia/issues/4034 – maxxyme Oct 22 '21 at 09:55
  • 1
    awesome comment. Thanks a lot @sunwarri0r. Not yet noticed, that this kind of imports are possible – suther Jan 03 '22 at 13:01
  • Great solution, Thanks a lot @sunwarr10r, this saved my day. – comul Aug 24 '23 at 07:26