Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Insomnia To Make Soap Calls

Tags:

soap

insomnia

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?

like image 415
efultz Avatar asked Jan 13 '20 13:01

efultz


2 Answers

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.

like image 154
Sebastian Avatar answered Oct 08 '22 06:10

Sebastian


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

like image 27
baermathias Avatar answered Oct 08 '22 04:10

baermathias