API Development

Axway + Solace Part 4: Axway App Integration + Solace REST Client

This is my fourth blog post in the journey to integrate the Axway platform with Solace PubSub Event Broker to bring more value to our customers. In this post, I work with a preexisting third-party service, Service Now (SNow), that does not have Eventing built in. Using the Axway iPaaS, which we call our Integration Builder (IB), I enhance the third-party app to support Event-Driven Architecture through our Event Polling capabilities. Once Events have been created, I then use IB Flow Builder to integrate the third-party app with Solace.

Recently, Solace released a detailed blog post on the value of integrating an iPaaS and their Event Broker. I suggest taking a look to get started.

Currently, I plan for this to a five-part blog series covering the following topics:

  1. Getting Started with Solace’s REST Client
  2. Enhancing Legacy Messages – Axway API Gateway and Solace REST Client
  3. Enhancing Legacy Messages – Axway API Gateway and Solace JMS Client
  4. Integrating 3rd Party Cloud Apps – Axway Application Integration and Solace
  5. Evolving Request/Response APIs to Events – Axway Streams and Solace

Overview

In this post, we will connect to the Service Now REST APIs with the Axway iPaaS. We will use the iPaaS to Poll for new Incident Creation Events every minute on SNow. When new Incidents appear, the Axway iPaaS will have an Event Flow triggered, which will pass information about the Event to the Solace Event Broker to Publish for consumers Subscribed to the topic.

Prerequisites

This post operates under the assumption you already know how to work with the Solace, Service Now and Axway Integration Builder. To start, set the Solace REST Client up to listen to a topic of your choice and create a Service Now Connector Instance in Axway IB.

Looking for a refresher? For detailed instructions on how to set up the steps not covered in this post, check out my previous blogs below:

Building the Flow

At this point, you should have your Solace REST Client configured, as well as the Service Now Connector Instance. From here, we just need to connect the two via a new Flow in Integration Builder.

  • Login to the Axway Platform and navigate to the IB Sandbox. Navigate to the Flows tab on the left-hand side. Select “Build New Flow Template.”

  • Choose “Build a New Flow,” choose a unique name, and choose an Event Type Flow. This Event type Trigger will operate against the Events configured in an associated Connector Instance. We will set the variable up as part of the trigger creation and associate it later when we create a Flow Instance. This will ultimately look for and trigger off the Events we configured in the Event Polling section of the Service Now Connector Instance, which we set up in the first blog post to happen once per minute. Click the “ADD EVENT” button to get started.

  • Choose a variable that will represent your Service Now Connector Instance. To do this, press the ‘+’ button twice, then choose the Connector Instance. Give the variable a name (e.g. dw_SNow). Select this variable from the list and save it.

  • This should bring you to the Flow Builder page. Press the Plus button in the Flowfield to add your first step.

  • Choose JS Script. Here we will set a message from the SNow data that we will ultimately send to the Solace topic queue of our choice.
    • Name the JS Script step. The name will be used in a variable name in the next step, so I suggest using something easy with no spaces (e.g. prepPostToSolace).
    • Create a variable to represent the body and headers we need and return it with JavaScript. Note: For simplicity, I encoded my username and password here and added it as a header. In a production environment, you would likely want to either use a variable to store this information or build a Connector for the Solace REST API.
Sample JS Script
let body = {“text”:'”‘+”Caller: “+trigger.body.message.raw.incidents[0].caller_id.display_value+” @ Impact: “+trigger.body.message.raw.incidents[0].impact+'”‘};
let headers = {
“authorization”:”Basic someBase64EncodedAuthToken”
}
done({body:body, headers:headers});
  • Check your JS Script filter looks like the screenshot below. If so, save and continue.

  • Click on the JS Script filter you created and choose “On Success” to add the next step. Choose HTTP Request. Fill it out as follows:
    • Name: WhateverYouWant (e.g. postToSolace)
    • Method: POST
    • HTTP URL: For your URL you will need your “Solace REST Host” you captured earlier in the Solace console. Add a trailing forward-slash (‘/’) and then add your topic variable to dynamically complete the URI and route to the appropriate Solace queue. Note: You could also use a variable here for the Host, Port and Topic to make a more reusable Flow.
    • Choose “Show Advanced.”
      • In the body field, refer to the body variable you set in the previous step. The name of the step will change based on what you called that step (e.g. ${steps.prepPostToSolace.body}).
      • In the headers field, refer to the body variable you set in the previous step. The name of the step will change based on what you called that step (e.g. ${steps.prepPostToSolace.headers}).
    • Save this and navigate back to Flows by clicking on the Flows tab to the left. Find your new Flow. Hover over it and choose “Create Instance.”
    • Configure the Flow Instance
      • Select the plus in the Service Now variable box. Select your Service Now Connector Instance.
      • Choose create Instance.

At this stage, you should have a flow that on new Incident creation in Service Now will create an Event within one minute that will post a message to the Solace message queue via the REST Client.

Demonstrate the Flow in Action

The next set of steps revolve around creating a new Incident in Service Now. This process is tracked in my Service Now and Slack integration devblog in the “Demonstrate the Flow in action” section (see Prereqs above).

  • Navigate to your Flow Instance in Axway Integration Builder. This can be done by clicking on the “Flows” tab, searching for your Flow Template, then selecting the number on it to see your Flow Instances. Hover over it and select “Executions.”

  • Create a new Incident via the Service Now console.
  • Recall we set the Event Poller to one minute. Refresh until you have seen the execution as “Pending” in yellow. A few seconds later refresh again and you should see success in green.

  • Hop over to your Solace Console. Check your Subscribe field. You should see the message has come through from Integration Builder and appeared in the Solace Event Broker.

At this point, every time a new Incident is created in Service Now, a message will be sent in near real-time to the Solace queue. Any applications that are needed to act on a new SNow event could be subscribed to this queue and act accordingly. The message could be extended to include the Incident ID, or even a full URL to the SNow API through Integration Builder to easily pull back all case info for any connected applications. This is the foundation of true Application Integration.

Conclusion

In this post, we showed how we could use Axway Integration Builder to add value to a third-party cloud application without Eventing built in to integrate with a topic of our choice in Solace using a reusable Flow. The same logic could be applied to any of the applications Integration Builder has Connectors for or any new systems for which we create connectors.

Thoughts on Improvements for Production Use

  • For this demo, I added the HTTP Basic credentials for connecting to Solace as a cleartext HTTP Header. This is not ideal for security reasons. Solace should likely be added as a Connector where we manage the credentials in the long run but could also be stored in a variable in the flow.
  • The Host, Port, and Topic should also likely be set to a dynamic variable for better reuse if Solace is not added as a connector.
  • The Connector Instance Variable could also be generalized to better illustrate its reuse across any Connector Instance. In this post, I used a variable that made it easy to track it was being used for our SNow connection.

Read about Axway API Management and the Solace JMS Client.