Invoking a REST API with BPEL
Aim: To invoke a RESTful web service from a BPEL Service.
Oracle SOA does not provide native JSON capabilities, atleast with 11g. 12c improves with a JSON adapter (XML<->JSON) but still is not native. So, in this blog post we wil continue to stick with REST services returning XML data. We will see how to make calls to these services from a BPEL composite.
Steps:
The RESTful service which we are going to use in this POC is the Google Geocode API.
- Drag and Drop a HTTP Binding Service Adapter into the right swim lane.
- Configure the adapter as per the below screenshots:
Configuring the Binding:
Provide the request – response structures to the REST service in form of XSDs.
You might need to create these XSDs based on the XML returned from the service in case it is not provided to you. You should be able to use a tool like Eclipse/JDeveloper to achieve this.
- The HttpBinding is now ready. Integrate it with the BPEL code the same way one does for other partner links i.e use an invoke activity to call it with appropriate request/response variables.
Result: We were able to call the Google Geocoding API through a BPEL process successfully.
Screenshots:
No comments:
Post a Comment