Calling a REST service endpoint from OSB 11g [Part 1 -Business Service]


POST
Here is am going to give complete exercise as to how shall we implement an OSB service which will intern call a REST based service endpoint making POST request.
To move ahead with this exercise we need to first know the Rest Service Endpoint, Request message and Response message etc.
We shall first test the service using any (or all) of the below tools:-

Postman Test Suite
SoapUI
CURL

Let’s start with the implementation. Below are the pre-requisites to know before you start:-

Endpoint-           http://10.11.12.50:1050/resource

Sample Request-           

{"AO":"VMAC""BN":"0""AR":"0011223344556677""BO":"6""BP":"20FC79C7"}

Sample Response-         

{"COMMAND": "[AOVMAC;AE1009;BBY;]",  "AE": "1009",  "AO": "VMAC",  "BB": "Y"}


Below is the screenshot from Postman Test Suite

 
Screenshot of request-response from SoapUI


 
Screenshot of request-response from CURL
 



NOTE:-
Once you test through SoapUI, after getting successful response, just click the ‘RAW’ tab. It will provide with all the header information needed to call the Rest service endpoint. See the screenshots below:-
 
Implementation

Create business service (Steps):-
  • Create a configuration project  and then an OSB project in OSB editor (eclipse)
  • Right click on  the project and then Goto “New->Business Service”
 
  • Give any name to the business service. I have given name as “myRestServiceBS”







Once it opens in editor, select ‘Messaging Service’ as ‘service type’ in ‘general’ tab and also follow below screenshots:-
 
 
 
 
 

No other setting is needed to configure except for those which you can see in above pictures. Leave rest of the things as it is.

Now, the Business Service (BS) is ready to test. Just deploy this on sbconsole and click on test button
NOTE:- No URI or relative-URI or parameters are needed to pass while testing BS through OSB console. Only transport header/header values are needed to pass which depends on service to service (REST Service). So, in our case we just need to pass below information along with Body to BS while testing:-
 
 
 

You will get the response as below:-
 
 

Featured Post

How to create an AQ (Advanced Queue) on Oracle DB

Keywords: Advanced Queue, AQ, AQ Creation, Queue, Queue Creation, How to create a queue, Queue in SOA, SOA, OSB, BPEL -------------------...