JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS REST Binding Component User's Guide     Java CAPS Documentation
search filter icon
search icon

Document Information

Using the REST Binding Component

About the REST Binding Component

REST Binding Component Features

Supported HTTP Methods

REST BC Sample Projects

Working With the REST BC WSDL Document

Creating the REST BC WSDL Document

To Create a WSDL Document for REST Inbound

To Create a WSDL Document for REST Outbound

New WSDL Wizard Properties for REST

Configuring REST BC WSDL Attributes

To Configure REST BC WSDL Attributes

Service Level REST WSDL Element

Binding Level REST WSDL Elements

REST Binding Element

REST Operation Element

Configuring the REST Binding Component Runtime Properties

To Configure REST BC Runtime Properties

REST Binding Component Runtime Property Descriptions

Creating Application Configurations for Connectivity Parameters (URLs)

To Create Application Configurations

To Add the Application Configuration to the Endpoint

To Change Application Configuration Values

Using Application Variables

To Create an Application Variable

To Use an Application Variable for Password Protection

Using REST BC Normalized Message Properties in a Business Process

Using Predefined Normalized Message Properties

To Use Predefined Normalized Message Properties in Mapper View

To Use Predefined Normalized Message Properties in Source View

Normalized Message Properties for REST

General Normalized Message Properties

REST Binding Component Normalized Message Properties

Implementing Jersey Client Filters

To Define the Jersey Filter

To Add the Filter to the Composite Application

Using REST BC Normalized Message Properties in a Business Process

You can define normalized message properties in a BPEL process in order to dynamically assign values to the runtime properties for the REST BC. The normalized message properties for each JBI component are accessed from the BPEL Designer Mapper view. When you expand a variable's Properties folder it exposes the variable's predefined NM properties, as well as the standard BPEL-specific WSDL properties used in correlation sets, assigns, and expressions . If the specific NM property you need is not currently listed, additional NM properties can be added.

Normalized message properties provide the following capabilities:

Using Predefined Normalized Message Properties

Predefined normalized message properties are automatically available from the BPEL Designer's Mapper view. You can use additional properties by adding them directly to the source code. You can either define these properties using the BPEL Designer Mapper, or by entering the code directly into the source view.

You can perform additional tasks when working with normalized message properties, such as creating additional properties, deleting properties, creating property shortcuts, and so on. For more information, see Using Normalized Message Properties in Oracle Java CAPS BPEL Designer and Service Engine User’s Guide.

To Use Predefined Normalized Message Properties in Mapper View

You can access most of the normalized message properties from the BPEL Mapper. Certain properties, such as path and query parameters, need to be defined in the Source view.

  1. Open the BPEL process you want to edit in the BPEL Designer.
  2. In Design view, select the activity to add the normalized message property to.
  3. In the BPEL Designer toolbar, click Mapper.
  4. In the Output pane, expand the variable you want to edit, expand Properties, and then expand REST BC.
  5. Expand Request Metadata or Response Metadata, depending on the message type.

    A list of available normalized message properties appears.


    image:Figure shows the normalized message properties for a REST request.
  6. Select the normalized message property you want to use, and use the mapper operands to build an expression or assign a value.

    For a complete list of normalized message properties for the REST BC, see Normalized Message Properties for REST.

To Use Predefined Normalized Message Properties in Source View

You can define any of the normalized message properties using the Source view. You can only access path or query parameters from the Source view.

  1. Open the BPEL process you want to edit in the BPEL Designer.
  2. In the BPEL Designer toolbar, click Source.

    The BPEL source code for the process is now visible.

  3. Declare the sxnmp namespace near the beginning of the process element; for example:

    xmlns:sxnmp="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension /NMProperty"

  4. Access the property using the property names listed and described in Normalized Message Properties for REST.

    For path and query parameters, separate normalized message properties are created for each. For example,

    <assign name="AssignActivity">
       <copy>
          <from variable="GetCustomerNameIn" 
                sxnmp:nmProperty="org.glassfish.openesb.rest.path-params.custName"/>
          <to>$CustomerQuery_OperationIn.part/ns0:param1</to>
       </copy>
    </assign>

Example 1 Using REST BC Normalized Message Properties for Query Parameters

There are two methods to use normalized message properties to encode information as query parameters in an outbound REST call. Both methods are illustrated below in examples that show how to define query parameters for a simple address.

The following example illustrates defining all the parts and assigning their values as a single string.

<copy>
    <from>'{"street":"800 Royal Oaks Blvd.", "city":"Monrovia", "state":"CA", 
          "zip":"91016"}'</from>
    <to variable="YahoomapIn" sxnmp:nmProperty="org.glassfish.openesb.rest.params"/>
</copy>

The following example illustrates defining each part as a query parameter and assigning the values individually.

<copy>
    <from>'800 Royal Oaks Blvd.'</from>
    <to variable="YahoomapIn" 
        sxnmp:nmProperty="org.glassfish.openesb.rest.params.street"/>
</copy>
<copy>
    <from>'Monrovia'</from>
    <to variable="YahoomapIn" 
        sxnmp:nmProperty="org.glassfish.openesb.rest.params.city"/>
</copy>
<copy>
    <from>'CA'</from>
    <to variable="YahoomapIn" 
        sxnmp:nmProperty="org.glassfish.openesb.rest.params.state"/>
</copy>
<copy>
    <from>'91016'</from>
    <to variable="YahoomapIn" 
        sxnmp:nmProperty="org.glassfish.openesb.rest.params.zip"/>
</copy>

Normalized Message Properties for REST

Normalized message properties are either specific to the binding component being used or generally available to all participating JBI components. The following topics describe both types of normalized message properties.

General Normalized Message Properties

The following table lists and described the general properties that are available to all JBI components. All property values are of the type java.lang.String.

Table 10 General Normalized Message Properties

Property Name in Source
Property Name in Mapper
Description and Use
org.glassfish.openesb. messaging.groupid
Group ID
Uniquely identifies a message with the group to which a message belongs.

This property is optional.

org.glassfish.openesb. messaging.messageid
Message ID
Uniquely identifies a message. For batch processing this might be a record number (for example, a particular record in a file) or a GUID.

This property is mandatory.

org.glassfish.openesb. messaging.lastrecord
Last Record
The value is a string representation of boolean ("true" or "false"). This property can be used to signal the last record in a group or the last record in a file.

This property is mandatory.

org.glassfish.openesb. exchange.endpointname
Endpoint Name
The value a string representation of the endpoint name set on the exchange. This represents the endpoint name of the "owner" of the message, and could be made available by JBI runtime.

REST Binding Component Normalized Message Properties

The following properties are specific to the REST Binding Component. Available properties are different for request messages than for response messages. All property values are of the type java.lang.String.

Table 11 REST Binding Component NM Properties (Request)

Property Name in Source
Property Name in Mapper
Description
org.glassfish.openesb. rest.url
HTTP Request URL
The HTTP URL of the external resource to be invoked.
org.glassfish.openesb. rest.method
HTTP Request Method
The HTTP method to use when invoking the resource defined above. Available methods are GET, POST, PUT, HEAD, and DELETE.
org.glassfish.openesb. rest.content-type
HTTP Request Content-Type
The content type header for the requesting entity, if any.
org.glassfish.openesb. rest.accept-types
HTTP Request Accept-Types
The acceptable media types for the request, specified in JSON format. Enter the types in square brackets with each type contained in double-quotes. Separate multiple values by a comma. For example:

[ "application/json", "text/plain" ]

org.glassfish.openesb. rest.accept-languages
HTTP Request Accept Languages
The preferred natural languages, specified in JSON format.
org.glassfish.openesb. rest.headers
HTTP Request Headers
Custom HTTP headers for the request. Enter the headers in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example:

{ "host" : "MyServer.com", "Content-Subtype" : "application/json/customers"}

org.glassfish.openesb. rest.headers.*
Not applicable
Arbitrary custom HTTP headers for the request. For example, to add the content type as a custom header parameter, you would enter a property similar to org.glassfish.openesb.rest.headers.content-type.

These properties can only be defined using the BPEL Designer's Source view.

org.glassfish.openesb. rest.params
HTTP Request Parameters
Custom parameters for the request. Enter the parameters in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example:

{ "status" : "Active", "billing" : "Current"}

org.glassfish.openesb. rest.params*
Not applicable
Arbitrary custom properties for the request. For example, if you are querying for telephone fields, you might have a set of properties like the following:
  • org.glassfish.openesb.rest.params.areaCode

  • org.glassfish.openesb.rest.params.number

  • org.glassfish.openesb.rest.params.extension

These properties can only be defined using the BPEL Designer's Source view.

org.glassfish.openesb. rest.param-style
HTTP Request Parameter Style
A style for the URI parameters. The following values are supported:
  • Query – Name and value pairs that specify attributes of the full URI (external resource). Query parameters are delimited by an ampersand (&) and are separated from the rest of the URI by a question mark (?).

  • Matrix – Name and value pairs that specify attributes of one segment in a URI. Matrix parameters can occur after the segment in the URI that they modify. Matrix parameters are delimited by a semicolon (;) and are also separated from the segment they modify by a semicolon.

org.glassfish.openesb.rest.path-params
HTTP Request Path Parameters
Custom HTTP parameters for the URI. Enter the parameters in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example:

{ "status" : "Active", "billing" : "Current"}

org.glassfish.openesb.rest.path-params.*
Not applicable
Arbitrary custom HTTP parameters for the URI. For example, the following properties define custom user login properties:
  • org.glassfish.openesb.rest.path-params.userName

  • org.glassfish.openesb.rest.path-params.password

These properties can only be defined using the BPEL Designer's Source view.

org.glassfish.openesb.rest.basic-auth-username
Not applicable
The login ID of the user for authentication. If the property is populated, a basic authentication header is added to the HTTP request.
org.glassfish.openesb.rest.basic-auth-password
Not applicable
The login password corresponding with the above user name. This property can only be access from the BPEL Designer's Source view.

Table 12 REST Binding Component NM Properties (Response)

Property Name in Source
Property Name in Mapper
Description
org.glassfish.openesb.rest.response.status
HTTP Response Status
The status code for the response.
org.glassfish.openesb. rest.response.url
HTTP Response Location
The location header for the response.
org.glassfish.openesb. rest.response.content-type
HTTP Response Content-Type
The content type header for the response.
org.glassfish.openesb. rest.response.headers
HTTP Response Headers
Other headers for the response. Enter the headers in curly brackets as name value pairs with the name and value each in double-quotes and separated by a space, a colon, and another space. Separate multiple name value pairs by a comma. For example:

{ "host" : "MyServer.com", "Content-Subtype" : "application/json/customers"}

org.glassfish.openesb. rest.response.headers.*
Not Applicable
Arbitrary custom HTTP headers for the response. For example, to add the content type as a custom header parameter, you would enter a property similar to org.glassfish.openesb.rest.headers.content-type.

These properties can only be defined using the BPEL Designer's Source view.