Passing parameters to a REST URI in BPEL/SOA 12c
In this blog post, I describe how, during the development of an Oracle SOA Suite 12c composite, to pass URL parameters when invoking an external REST service.
In this example, my SOA composite has 2 separate external references. These are both REST services using the GET method. The first one take the format of https://revelationtech.com/rest/v2/subscribers?q=firstname
wherein an explicit query parameter q
is passed in the URL with some value after it. The second reference takes the format of https://revelationtech.com/rest/v2/subscribers/Ahmed
, wherein Ahmed
is a parameterized part of the URL.
Passing a Query Parameter to the REST URI
For the first reference, when creating the REST adapter, it looks like the following:
When editing the method, it is configured as a GET
method and the URI parameter is defined with a runtime property rest.query.q
:
Now that the REST adapter is created, double-click on the Invoke activity in your BPEL process, navigate to the Properties tab, and manually add a property as shown. Here, the BPEL variable $inputName
becomes the value that is passed to the rest.query.q
property:
Adding a Parameterized Context Path to the REST URI
As for the the second reference, you can see here when creating the REST adapter, the {inputID}
is explicitly defined as a variable in the resource path:
Now when you edit the method, it is also a GET
method, but the runtime property here is now rest.template.inputID
:
Similarly, when editing the Invoke activity in your BPEL process, simply add a property to map your BPEL variable (e.g., $input
) to the runtime property (e.g., rest.template.inputID
):