Designer > Custom Service Interactions > Using a REST-based Service

Using a REST-based Service

You can create web service interaction activities in BPEL that can handle messages based on the Representational State Transfer (REST) architecture rather than WSDL operations. This means that you do not need your own WSDL file in order to create certain types of BPEL processes. You can simply instantiate a process with a request that looks like the following example:
REST is a style of architecture for describing how resources are defined and addressed on systems such as the World Wide Web. Using REST, you can send and receive REST-based messages over HTTP without an additional messaging layer such as SOAP.
You can also access partner REST services from a BPEL process.
The idea of REST is that clients and services can communicate over HTTP to exchange representations of resources. A resource is any item of interest, made accessible through some URL on the network. In BPEL, a representation is an XML document with optional attachments of a different content type.
A BPEL process can send and receive a REST request. When a REST request is sent to the process, Process Server converts it to a standard WSDL message. When the process invokes a REST service, a standard WSDL message is converted into a REST request. The response is a document representing the requested resource. The document type returned is defined by the Content-Type header of the HTTP response.
To get started with REST, you need the following:
See Also:

Creating a REST-based Receive or Invoke

In a REST-based service, you can create a start activity (receive, pick, event handler) that executes the URL request that is submitted through the address field of a Web browser or an HTTP client. You can also create an invoke activity that sends a request to a web-based service via HTTP.
The receive and invoke activities must be based on a WSDL file named aeREST.wsdl. The port types and partner link types for this WSDL are in the System Services tree in the Interfaces dialog in Participants view.
In essence, the WSDL defines the RequestResponse operation and messages for receiving and sending REST requests. Process Developer converts an incoming REST request to a WSDL message and does the reverse for an outgoing request.
A request that targets a REST-based process looks like the following example:
REST Request Message
Process Server converts the request to an input message that would have the following parts, shown in the example:
RestRequest example (Not all elements are shown. See the table below):
<?xml version="1.0" encoding="UTF-8"?>
<ns2:RESTRequest xmlns:ns2="
<ns2:param name="temp" value="50"/>
<ns2:param name="windchill" value="40"/>
<ns2:payload contentType="text/xml">lookUpWeather/mass/waltham?temp=50&windchill=40</ns2:payload>
The message parts are defined as follows:
Optional for partner service (invoke). The part that identifies one of the REST-based services that a domain can offer. For example Yahoo offers search, news, and other services. You can use the subdomain part to specify the service you want to use. In the endpoint reference for the partner link, you can add a logical subdomain value that can be replaced by the subdomain specified: <WS-Address></WS-Address>.
The HTTP method to execute. See the HTTP Methods table below.
Optional for partner service (invoke). Parts that extends the resource details defined in WS-Address. For example, in, you can specify the path info for the search service, version number, and specific type of search:
(Optional) Query parameters specified by the REST service you want to address.
(Optional). HTTP headers containing connection, host, content type and other request details.
(Optional) The representation of the resource. This data can be character data or XML data. If it is character data, you should include the contentType attribute.
(Optional) The string shown as it is formatted in the request. Contains parameters in the order they are specified.
(Optional) Value populated for inbound requests (receives). This value is equivalent to the value returned by getAuthType() method in javax.servlet.ServletRequest.
The value can be one of the following: BASIC, FORM, CLIENT_CERT or DIGEST
(Optional) Boolean. True if the request is sent as https.
(Optional) The application called in the request.
(Optional) The location of the service where the request is made.
(Optional). The ISO 639 Codes for country and languages. For example, <locale country="US" lang="en">en_US </locale>
HTTP Methods:
HTTP defines eight methods indicating the action to be performed on the resource.
Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
Requests a representation of the specified resource
Submits data to be processed (for example, from an HTML form) to the identified resource. The data is included in the body of the request. This can result in the creation of a new resource or the updates of existing resources or both.
Uploads a representation of the specified resource
Deletes the specific resource.
(Not supported for receives) Echoes back the received request so that a client can see what intermediate servers are adding or changing in the request.
Returns the HTTP methods the server supports. This can be used to check the functionality of a web server.
(CURRENTLY NOT SUPPORTED) Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.
REST Response Message
The REST response message contains the parts shown below.
If you generate sample data for the response, be sure to change the statusCode attribute to a valid HTTP Status Code. The standard response for a successful HTTP requests is 200. The generated integer, "1", results in a fault being thrown.
<rest:header name="string" value="string"/>
<rest:payload contentType="string">
<!-- Payload information -->
If rest:payload is not qualified, it does not inherit the aeRest.xsd namespace as it did in Process Developer versions prior to 9.2. If you had relied on this inheritance, your XPath expressions may no longer work until you update your process.
REST Fault Message
A sample REST fault looks like the following:
<rest:RESTFault xmlns:rest="" errorType="transport">
<rest:message>Bad Request</rest:message>
<rest:messageDetails>The request cannot be fulfilled due to bad syntax</rest:messageDetails>

BPEL REST Messages

The aeREST.xsd schema defines three message types:
For examples of each message type, see Creating a REST-based Receive or Invoke.

Handling of Multipart HTTP Messages

Receives and Invokes support multipart HTTP messages.
There are two distinct classes of multipart messages, multipart/form-data and all others (for example, mixed, related, digest, parallel). Multipart/form-data represents data from an HTML form construct that can have parameters and files.
Multipart messages are parsed and populated in the RESTRequest message as a payload and attachments. The first textual message part is the payload all others are attachments.
For multipart/form-data, parameters are converted to RESTRequest message parameters. The first textual form data file becomes the payload, all others are message attachments. When there are no textual files there is no payload only attachments.
Multipart messages are created implicitly when there are at least two of any combination of payload and attachments. The default Content-Type sent is multipart/mixed unless a multipart Content-Type header is defined in the RESTRequest message. An explicit Content-Type header of type multipart/form-data changes the behavior to emulate an HTML form submission. In this case all RESTRequest parameters in the payload are treated as HTML INPUT parameters, and attachments are treated as files.

Specifying Deployment Details for a REST-based Process

When you create a PDD file for a REST-based process, you must add the resource details and policies for the My Role and Partner Role endpoint references.
Partner Role
For a Partner role endpoint reference, select REST for the Invoke Handler. You can also add a HTTP Transport Policy Assertion to specify service timeout values.
There are no service bindings in the aeREST.wsdl so you can provide the endpoint reference by supplying the URL to the resource, such as:
To use variable replacements for the specific service of the domain, you can use parameters in the address, such as:
The parameters can then be specified in the request message, as described in Creating a REST-based Receive or Invoke.
My Role
For a My Role endpoint reference, ff the process is receiving REST requests, you must add a policy assertion for a REST-enabled service.
A REST service context policy example is as follows:
description="short description of the service"/>
This demo returns search results from multiple
search engines.
The accepted url format is:
keyword - the phrase to be searched for