Saturday, 2 May 2020

Create REST Web Service using Oracle Integration Cloud (OIC) - Integrations

Summary:
In this blog i'm going to explain the procedure to create REST web service in Oracle Integration Cloud (Integrations) which will be used to expose the integration as a web service to external consumers.

We are going to create a web service in this blog which will accept first name and second name of user and output will be greeting as described below

INPUT      :  <first name> 
                    <second name>
OUTPUT  :  Hello <first name  second name>

HTTP Method: POST

Assumption:
1. OIC instance already configured in Oracle Cloud and the environment should be up and running
2. Login user has at- least developer privilege for OIC.


Let's begin by first creating a Trigger REST connection

Steps to Create REST Connection as Trigger:
1. Goto Connections page in OIC integration with the help of below navigation.
      a.  Login to OIC instance   (e.g:  <host:port>/ic/home/)
      b.  Click on Integrations from the home menu (i.e. if landed on to OIC homepage post login)
      c.  Click on Designer from the integration menu
      c.  Click on Connection from the Designer menu
      d.  Click on Create button as shown below


2. Search for REST in the search bar and select the REST adapter or connection as shown below
  

3. Give the connection name, identifier, role and description in the window for REST connection creation as shown below and then click on 'create' button.

   


 Below are few points to be noted about the connection parameters
         i. Name: 
             This can be any name suitable for project or any project specific identifier.
         ii. Identifier: 
             This field value is auto generated by OIC and is used as a reference for integration while consuming it during integration development or could be used for uniquely identifying the connection while using OIC API's for connections.
         iii. Role: 
            Trigger is used when the connection is used as entry point for integration or for the external consumers to consume the service built. 
            Invoke is used if the integration consuming this connection want to communicate with external SOAP web services or references.
            Trigger and Invoke is used if the connection is used both as a entry point as well as a reference for invoking SOAP web services.

4. In next screen click on 'Test' and 'Save' button and then close the connection page
   

We have now successfully created REST connection as Trigger to consume in our integration. 

Let's now build our web service

Steps to Create Integration to expose as a REST web service:
1. Goto Connections page in OIC integration with the help of below navigation.
      i.   Click on Designer from the integration menu
      ii.  Click on Integration from the Designer menu
      iii.  Click on Create button as shown below

2. In the pop up window fill the Name for integration, Description, Version, Keyword and Package details if any and then click on Create button  

3. Click on the '+' icon at the top of screen and select the trigger connection which we created in earlier steps
    


4. In the pop up screen give some meaningful name for the connection and then click on next 


5. Fill the details for 'resource URI', select http method to POST under action, select check boxes to configure request and response payload for the endpoint and then click on Next button
   

6. Select the request payload format to JSON from the list of values/ drop down and then click on inline as shown below
   

7. Paste the sample JSON request payload as shown below and click on OK button
   

8.  Select the response payload format to JSON from the list of values/ drop down and then click on inline as shown below
   

9. Paste the sample JSON response payload as shown below and click on OK button

10. Then keep everything to default and click next -> done.
11. The flow will look similar to as shown in below screenshot 
    

12. Click on 'Map' activity in the flow and map output as concatenation of Hello, First name and Second Name
   


13. Update Tracking variable and Activate the integration. 
    Updating tracking variable and activating integration is described here
   
14. Copy the resource URL and test the service from Postman or any of your preferred testing tool and validate the service built as shown below



Hope this blog helped you in building REST Web Service using Oracle Integration Cloud. 

Let me know in comments section for any queries.


Know Yourself Blogs...

No comments:

Post a Comment

Access Microsoft Outlook email using Outlook Version 2.0 API

Summary: This blog demonstrates the steps involved to access Microsoft Outlook email using Outlook Version 2.0 API's. Use Cas...