WSO2Con 2013 CFP Banner

Copying the Options' Properties into RM Messages

Discuss this article on Stack Overflow
By Chamikara Jayalath
  • 11 Mar, 2007
  • Level: 
  • Reads: 3867

The Axis2 client API allows you to pass various properties into the system using the Options object. The Options object is a part of the MessageContexts that are created for each invocation. The properties are used by the core Apache Axis2/Java engine or any other module that you deploy into it.

Chamikara Jayalath
Software Engineer
WSO2 Inc.

When reliable message exchanges take place with Apache Sandesha2/Java, you will observe that various RM control messages are exchanged while the application message exchange is taking place. They include RM sequence management messages and RM acknowledgment messages.

Sometimes you may want a certain property in the Options object to be available in all the messages that are created and sent through the handler chain. For example, you may be setting a certain security policy for configuring Apache Rampart/Java. However, you observe that this policy is available only for the application messages, and that the RM control messages are sent without adhering to this security policy.

The remedy for this is to add the following parameter to the Sandesha2 module.XML.

<parameter name="propertiesToCopyFromReferenceMessage">key1,key2</parameter>
<parameter name="propertiesToCopyFromReferenceRequestMessage">key1,key2</parameter>

When you set the first parameter, all the RM messages of the client side will contain the properties you set to the Options object with the keys Key1 and Key2.

The second parameter is for the server side. Here the properties are copied from the request message to the RM messages of the out path.

In addition to the above, if you also want to copy the property 'abc' to the RM messages with the key 'xyz', you can set the above parameter as follows.

<parameter name="propertiesToCopyFromReferenceMessage">key1,key2,abc:xyz</parameter>

You can use this to set two different security policies for Application messages and RM control messages. You may need to sign and encrypt the Application messages but the RM control messages may only need to be signed.

Applies To:

Apache Sandesha2/Java, 1.1 and above.