How to expose REST Service in Dell Boomi ?

This blog demonstrates how to expose REST Service in Dell Boomi

In this blog, we will see how to develop REST web service in Boomi.

What is Rest?

Rest stands for Representational State Transferand .It uses HTTP Protocol as the transport protocol. In rest, we consider all the objects /data to be termed as resources and every resource is represented by an URI(Uniform Resource Identifiers).It supports all the data formats like XML, CSV but the one which is more commonly used is JSON which stands for Java Script Object Notation. JSON stores data in the form of key and value.

  • To develop any REST service in Boomi, we have to configure a connector called as “Web Services Server” connector.
  • In this example, we will develop a REST web service which will perform addition of two numbers with data in JSON format.

Now, let us begin with the steps to develop REST web service.

Step 1:

Logon to Boomi platform (https://platform.boomi.com/) with required credentials i.e.Email Address and Password.

Step 2:

Once logged into Boomi platform, we will be able to view Home page.

Step 3:

Now, click on Services followed by Integration. We will see the Build page. Click on New.

Step 4:

Once, clicked on New, we will be able to see three fields i.e Type, Component Name and Folder.

  • Select Type as Process as we are creating the process to develop web service. Component Name and Folder can be given based on your choice (i.e which name to be given and where do we want to create the process). Click on create.

Step 5:

We see that the process gets created with a start shape which is configured with AS2 Shared Server by default.

Step 6:

Now click on start shape and select the connnector as “Web Services Server” connector.There will be only one action i.e Listen(by default). Select + on operation to create a new one.

Note: In order to user web services server connector you must have service enablement feature enabled on your subscription. Also. the usage of this connector doesn’t cost you an additional connection license.

Step 7:

Give a relevant name to the operation and configure the following.

  • Operation Type:We have to choose the field based on the operation which we are going to perform.In this case, we are creating a web service for adding two numbers. Therefore,Operation can be create.
  • Object: It can be given any name based on the operation. Here, we are giving it as add as we are adding the numbers.
  • Expected Input Type:We have to choose input based on the profile we want to add i.e (XML, JSON etc). Here, we are considering Expected Input Type as Single JSON Object . The request profile in this example will be in JSON format.
  • Request Profile: To choose the request profile, click + and give it a relevant name.Choose import.
  • We will have to choose input file from the location where sample json file is saved. Click Next

Sample JSON File AddRequest.json looks like:

{

“num1” :  10,

“num2” :   40

}

  • We see that the profile is loaded successfully. Click Finish, Save and Close.
  • Response Output Type : We have to choose the output based on how the data should be returned as response. Here, we are expecting the output to be in JSON format. Therefore, we are considering Response Output Type to be as a single JSON object as response in this example would be in Json Format.
  • Response Profile : To choose the response profile, click + and give it a relevant name.Choose import.
  • We will have to choose the output file from the location where file is saved. Click Next

Sample JSON File Add Response.json file looks like :

{

“result”: 50

}

  • We see that the profile is loaded successfully. Click Finish, Save and Close.

Post choosing the request and response profiles.clickon save and close.

Step 8:

We can configure any shape after the web services server connector depending up on the requirement. Here, we are placing map shape after webservices server connector as operation is to add two numbers and map shape is loaded with some pre-defined functions. We choose Math Add function which is under Numeric related functions.This is a predefined function that helps to perform add operation.

Now, let us see how to configure map shape.

  • Place Map shape after WebServices Server connector. Select map and click on + and name the map shape as Add Map.
  • Letus add profiles to the map. Click on choose in map and select profile Type as JSON. Select the same request and response profiles which we have configured in WebServices service connector.
  • Map looks like as follows after selecting source and destination side profiles.
  • To add a function in map, click + on function. We see functions related to String, Date, Numeric and so on. Select Numeric as we are performing addition.
  • Choose Math Add from the dropdown. Click ok.
  • We will now see that function got added to the map.
  • Provide mapping i.e num1 à Value, num2 à value to Add and Result will be mapped to result. Click save and close.

Step 9:

Next, we have to place return document shape at the end to send back the response. Connect all the shapes as shown below:

Step 10:

Now, deploy the process which we have created. Click on create packaged component.

  • The process gets selected automatically. Click Add Details.
  • Next, select the version and write notes if you have any. Click on create packaged component.
  • Now, we see that the package has been created successfully and click on deploy.
  • We will then have to select the environment. Choose one and click select version and review.
  • We will be asked to cross check the environment which we have configured in deployment tab.
  • Once we click on deploy we will be able to see that deployment is done successfully.

Step 11:

Now close deployments and navigate to 0manage tab followed by atom management.

Step 12:

Now, select the atom to which process is deployed and click on shared web server. You see the base url which is highlighted in the below box and is required for establishing the connectivity with the RES webservice. Copy the base url.

Step 13:

Now, go to build page and select webservices server connector. Click on edit symbol of the operation.

Step 14:

Copy the simple url path which is the resource path.

Now, we have to append base uri with resource path to form the complete endpoint required  to invoke the REST service.

Complete Url looks like

Step 15:

Now, test the webservice in postman by giving all the required inputs as shown in the below screenshot and click send.

You will be able to see the response.

Leave a Reply

Your email address will not be published. Required fields are marked *