Receive SOAP message

This guide describes how to receive a SOAP message in iHub and process that message as a issue.

Step 1.

  • Click on Incoming Webhooks on the left side menu.

  • Click New Rule
    The rule will map what action to to run



  • Name the rule anything related to the incoming system, in our example SOAP incoming message

  • For now leave the Rule HTTP response as “No Response”

  • We will add a THEN action to this rule at step 3.

  • Click Save

 

Step 2

 

Step 3. Modify the Incoming Webhook rule

  • Click the Webhook Rules again

  • Click three dots, then Edit on the Rule created in Step 1.

  • Select the SOAP to Issue action in the THEN box

  • Click Save.
    Note that IF condition can be added to make sure the right action is triggered. In this tutorial we only have one, but as your integration grows you can add more rules and filter by URL, DATA or User.



This concludes the incoming webhook part of receiving a SOAP message an passing it into an action that will create the issue.

Next up is the steps on how to parse the SOAP message to become variables used in the Action body as mustache variables. eg. {{summary}}, {{description}} and {{priority}}

 

Step 4. Parse the SOAP message

  • Click on Variables on the left menu

  • Click Groovy tab

  • Click Add Variable

  • Enter the name, in our example call it soap.
    The variable will be accessed using {{soap.summary}}.

  • Select “Enabled for these action(s)” in the drop down, we will select the SOAP to issue action created in step 2.

  • In the Script paste the following code

    import org.json.JSONObject import org.json.XML import com.fasterxml.jackson.databind.ObjectMapper int textIndent = 2 JSONObject xmlJSONObj = XML.toJSONObject(response) def jsonObject = xmlJSONObj["soap:Envelope"]["soap:Body"]["example:CreateIssue"] ObjectMapper objectMapper = new ObjectMapper() def parsedObject = objectMapper.readValue(jsonObject.toString(), Map.class)

     

  • This will parse any incoming xml as JSON and return it as a variable to use in the mustache of the Action. Note that we have pointed out the <example:CreateIssue> node in line 7, that might look different in other soap messages.

    example this SOAP message

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:example="http://www.example.com/soap-api"> <soap:Header/> <soap:Body> <example:CreateIssue> <example:Summary>Fix critical bug</example:Summary> <example:Description>This is a critical bug that needs immediate attention.</example:Description> <example:Priority>High</example:Priority> </example:CreateIssue> </soap:Body> </soap:Envelope>

Will look like this, after the conversion.

 

These are the steps to setup the integration, it should now be fully functional for getting any SOAP message.

 

Note that the groovy script will try to parse the result into a JSON object, if the information in that you need is a string then remove the mapper part and it will look like this;

Step 5. Testing

Testing can be done from any tool or SOAP system. We use iHub to test this integration.

  • Create an Integration

  • Name it SOAP test incoming

  • Select a Basic authentication

  • Add this to the Body

     

  • Press Test button

  • Result should be a new Issue created with the summary “Fix critical bug”, description “This is a critical bug that needs immediate attention.” and Priority “High”