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:
Getting and setting transport context properties, such as REST headers.
Getting and setting request parameters.
Dynamically configuring REST 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 BPEL Designer and Service Engine User’s Guide.
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.
Open the BPEL process you want to edit in the BPEL Designer.
In Design view, select the activity to add the normalized message property to.
In the BPEL Designer toolbar, click Mapper.
In the Output pane, expand the variable you want to edit, expand Properties, and then expand REST BC.
Expand Request Metadata or Response Metadata, depending on the message type.
A list of available normalized message properties appears.
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.
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.
Open the BPEL process you want to edit in the BPEL Designer.
In the BPEL Designer toolbar, click Source.
The BPEL source code for the process is now visible.
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"
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> |
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 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.
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. |
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)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. |