Using a webhook for SOAP API

I am having trouble using a webhook to receive notifications from a web application that uses the SOAP file format. When I test the webhook using a standard POST or GET method I can see the reply and debug log in my workflow, however I have not seen any logs (even errors) from the web application when it publishes messages.

My first issue was the web application was not able to use the Losant-provided URL due to an invalid character (’$’). I shortened the URL using bit.ly but that didn’t seem to help either. Any tips on how I can configure the webhook?

applications/5f0646f3599cfa00069ddd19/workflows/5f171dece3d5480007906bf9

My first thought is that since there is an http/https drop down, you may need to remove that from the URL.

Also, I’d like to get some clarification on the $ in the webhook URL. It wasn’t completely clear from your post whether or not that was the source of an issue.

What service is this and do they have documentation for this feature we can look at?

I tried removing https:// from the URL but that doesn’t seem to be an issue (their platform takes doesn’t append it and I verfied another https:// URL passed the ‘validation’ check).

The application developer stated that ‘$’ was an invalid character for a WSDL URL. Honestly, I am not that familiar with SOAP but I do have documentation on how to access their SOAP API’s. I can also successfully make requests to their endpoint, https://portal.verizongridwide.com:10000/PolicyNet, using an HTTP Node and XML Node to parse the reply.

I could share the documentation with you or anyone else but it’s a large file so I’d have to send a download or email link.

Thanks for the input!

We’ve got a ticket opened to remove $ from generated webhook URLs. For the moment, however, I’d recommend switching to an Experience Endpoint to remove the $ as a potential issue.

An Experience Endpoint works in a very similar way to a Webhook, but does provide some additional features and customization. You can use the Endpoint Wizard to quickly create a new endpoint that essentially mimics the behavior of a Webhook.

I’d recommend creating an Experience Endpoint using the following configuration:

  1. Choose Return data for an API.
  2. Method is POST.
  3. Route is anything you want, but maybe /soap.
  4. Choose to use an existing Workflow.
  5. Access Control is set to All public users.

When this is complete, you’ll now have a new URL that you can try. It will be in the format:

<your-app-id>.onlosant.com/soap

You can now swap your existing Webhook trigger for an Endpoint Trigger and select this newly created endpoint as the source.

Success! I tested it and the messages are coming through in the “body” of the payload:

Now on to the next step of using the XML parser Node to get the elements and attributes I’m looking for. In SOAP that is usually defined in a WSDL file. Any idea if XML parsing can be done using that type of file? Maybe a custom Node?

You should be able to use the HTML/XML Parser Node to obtain the fields you’re looking for.

The node supports a selector, which can be pretty powerful when looking for specific fields. I’ve found that parsing XML is not the easiest thing in the world, so you’ll have to experiment with selectors to get what you’re looking for.

What I usually do is copy that XML and then use something like Postman to send it back to the workflow over and over again. That can sometimes be an easier way to test and develop versus getting an actual result from your external service.

1 Like

Hey @Jeff_Cuthbertson, I noticed there’s a File Format drop down that is currently set to SOAP. That wouldn’t happen to have a JSON option, would it? JSON would be a much easier format to work with inside a workflow.

Unfortunately SOAP and Multispeak are the only formats supported. I agree JSON would be much easier. I’ll be working on this again today and may reach out with help parsing the XML file. Fortunately I have the WSDL so I know how it’s defined but it’s still tedious.

Our selectors are standard CSS selectors. There are a number of tools available to interactively test those, which might also be helpful. Here’s one example I found:

https://try.jsoup.org/

You should be able to paste your XML in there and then try out some selectors until you find some that are able to extract your required fields. The results you receive in Losant may be slightly different, but this will at least get you close.