Skip to content

How to Invoke a RESTful Service

You can use Process Designer to invoke RESTful services and use them within your process.

To invoke a RESTful service

  1. Drag a RESTful extension activity from the Palette to the process you are building in the BPEL Editor.

restful palette

  1. In the Properties panel open the Details tab, and set the different settings required to invoke the RESTful activity. These options are specified in the RESTful service you are invoking.
  2. Select the request method being used by the RESTful service: PUT, DELETE, GET, or POST.
    • Use PUT to update or change the state of a resource
    • Use POST to create a resource on the server
    • Use GET to claim a resource
    • Use DELETE to remove a resource
  3. Enter the path to the service. If you are using HTTPS you can verify the certificates by clicking Validate Certificates.
  4. In the Parameters field, click copy rule icon to enter any parameters required by the service.
  5. Open the Body tab to enter the input to the service if the request method (entered on the Details tab) is PUT or POST.
  6. Continue building your process, creating copy rules to specify the inputs and outputs you want.

How to create the XPath expression to get the correct data from the call to the RESTful service

You can use the ODE function ode:dom-to-string to determine that the XPath expression you create when building your project is getting the data you expect from the RESTful service.

  1. Add an Assign activity to your process.
  2. Open the Copy Rule dialog box, choose Expression in the From drop down list, and click Expression Editor.
  3. From the Functions panel, open the ODE node and double-click ode:dom-to-string. This inserts the function in the Expression field.
  4. In the Variables panel, double-click RESTfulOutput.XMLResponse. This becomes the From part of your copy rule.

    ode to string

  5. Click OK to close the Expression Editor.

  6. In the Copy Rule dialog box, specify payload.Response as the To portion of the copy rule and click OK.
  7. After deploying and executing the service you can see the entire XML returned from the call to the RESTful service and can make sure that the process is receiving the correct data. You may not know, when you are creating a process, the value you need. You can use ode:dom-to-string to determine which element to call in the XPath expression. In the tutorial the XPath expression is Expression[$RESTfulOutput/extensions:XMLResponse/id/text()].

To test the service

You can use a browser to test GET method types. There are third-party tools available, such as soapUI, to test the other request types.

More information