You can set up a business process to access the values of specific user-defined fields in a JMS message header.
Set up your business process to iterate over the Property elements in a loop, checking the field name at each iteration. Then, use an Assign activity to transfer the data to an outbound transport.
Use the following example business process to guide you through the process.
To user-defined JMS header information in a business process:
Create a New Project from Template using the WorkSpace Project with Schemas template.
Define a Reply To Address Business Process variable to capture the JMS inbound message data:
Expand the Business Process Variables section.
Select operation1Request in the business process canvas.
Right-click Local Variables and select New variable from the context menu.
Name the variable. Select newVariable# from the Local Variables list, expand the Properties panel, and enter a variable name in the Name field, such as JMSHdrCtxt.
Define the Datatype. Select Reply-To Address.
Select operation1Request in the business process canvas again.
Select JMSHdrCtxt variable from the Reply-To-Address Variable drop-down menu.
Save the service. Select File|Save from the main menu bar.
Define a Complex Business Process variable to access the JMSHeader schema:
Select operation1Request in the business process canvas.
Right-click Local Variables the Business Process Variables section, and select New variable from the context menu.
Name the variable. Select newVariable# from the Local Variables list, expand the Properties panel, and enter a variable name in the Name field, such as InboundJMSHeader.
Define the Datatype as a Complex Type:
Select Complex Type in the Properties panel and browse for the schema file contained in the WorkSpace project.
In the left pane of the Schema Browser, select jmsHeader.xsd.
In the right pane, select the JMSMessageContext {http://schemas.sybase.com/services/transport/jms/V1.0/} node and click OK.
Save the service. Select File|Save from the main menu bar.
Transfer the data from the JMSHdrCtxt to the InboundJMSHeader business variable, using an Assign activity:
Click inside the Business Process canvas.
Select Assign from the Activities palette and drag it on to the Business Process canvas.
Define the source and target variables for the Assign:
Specify the Reply-To Address variable as the Source for the assign. Drag the JMSHdrCtxt variable from the Business Process Variables section onto the Source column in the Properties panel.
Specify the Complex type variable as the Target for the assign. Drag the InboundJMSHeader variable from the Business Process Variables section onto the Target column in the Properties panel.
Save the service. Select File|Save from the main menu bar.
The values of the default JMS Header fields are now accessible for use in Assign activities a single-rule expression from the InboundJMSHeader variable in the Business Process Variables section.
Create two Local variables for the business process:
Select the Business Process tab to display the business process canvas.
Click inside the Business Process canvas to display the available variables in the Business Process Variables section.
Right-click the Local Variables category and select New variable from the context menu twice.
newVariable1 and newVariable2 are added to the Local Variables list.
Expand the Local Variables list, right-click NewVariable1, and select Edit variable from the context menu. Then expand the Properties panel and change the variable Name and Data type to the following:
Name = counter
Datatype = Simple/integer
Expand the Local Variables list, right-click NewVariable2, and select Edit variable from the context menu. Then, change the variable name and data type in the Properties panel to be the following:
Name = headerFieldValue
Datatype = Simple/string
Save the service. Select File|Save from the main menu bar.
Add a Complex activity to the business process to iterate over the Property elements of the JMSHeader while checking the field names at each iteration. Use the following example:
Select Complex from the Activities tool palette and drag it on into the canvas.
Define the properties for the Complex activity:
Select the Properties tab and rename the activity to Loop.
Select the Iteration Settings tab and select This activity runs iteratively to open the Expression editor.
Drag the counter (Local variable) from the Business Process Variables section to the Counter variable field in the Iteration Settings.
Click … in the Counter initial value field to open the Variable Reference Dialog. Select Literal and set the value to 1.
Click … in the Counter increment field to open the Variable Reference Dialog. Select Literal and set the value to 1.
Save the service. Select File|Save from the main menu bar.
Define an expression for Loop using the following example:
Replace the Select Variable in the Expression editor. Drag the Local variable counter from the Business Process Variables section onto the Select Variable.
Delete the is equal to and string constant from the Expression editor. Right-click each icon and select Delete from the context menu.
Drag the Local variable counter from the Business Process Variables section onto the Expression editor.
Add another operator. Right-click inside the Expression editor canvas and select Boolean Functions|is less than or equal to.
Connect the counter operator to the upper node of the is less than or equal to operator.
Add another operator. Right-click inside the Expression editor and select Node Set Functions|count.
Expand the InboundJMSHeader variable and navigate to Property node.
Drag the Property node onto the Expression editor.
Connect the Property to the input terminal of the count operator.
Connect the count operator to the lower node of the is less than or equal to operator.
Save the service. Select File|Save from the main menu bar.
Add Single-rule logic to the Loop. See Using the Expression Editor for more information.
Click inside the canvas and then select the Tool Palette using the Fast View shortcut bar.
Select Single-rule from the Logic palette and drag it on to the canvas.
Define the single rule as in the Properties panel using the following example:
Expand the InboundJMSHeader variable and navigate to Name element in the Property node.
Replace the Select Variable in the Expression editor. Drag Name element from the Local Variables list in the Business Process Variables section onto the Select Variable.
Select the final string constant in the editor, and rename the constant in the Properties for Operation view to have the same value as the JMS header field you are capturing. Then, select the Bind Source Text to Logical Name checkbox..
Edit the XPath of the Name element to specify the index of the Property element that is being tested:
Select the Name element in the Expression editor to display its properties.
Click Advanced in the Properties for Operation view to open the XPath Workarea dialog.
Edit the XPath to use the following value and click OK:
/InboundJMSHeader/sy1:JMSMessageContext/sy1:ApplicationProperties/sy1:Property[/counter]/sy1:Name
Add an Assign activity to the Loop:
Drag Assign from the Activities palette and drag it after the Single-rule.
Define the Source and Target variables for the Assign:
Select the Assign activity.
In the Properties panel, click
in the Source column to open the Variable Reference dialog.
Define the Source variable. Drag Value from the Local Variables list in the Business Process Variables section to the Source column in the Properties panel.
Define the Target variable. Drag headerFieldValue from the Local Variables list in the Business Process Variables section to the Target column in the Properties panel.
Edit the XPath of the Value element to specify the index of the Property element that hits:
Select the Assign tab.
Select the Value element in the Expression editor to display its properties.
Click Advanced in the Properties for Operation view to open the XPath Workarea dialog.
Edit the XPath to use the following value and click OK:
/InboundJMSHeader/sy1:JMSMessageContext/sy1:ApplicationProperties/sy1:Property[/counter]/sy1:Value
Save the service. Select File|Save from the main menu bar.
Connect the flow of execution in the Loop and minimize the Loop activity.
Connect the flow of execution in the business process.
Save the service. Select File|Save from the main menu bar.
Using Default JMS Message Header Information in a Business Process
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com