Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Web Service Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

18.3 Manipulating a Service's Session Data

You can modify the session data in the rwsf::CallInfo object at any point along the message handler chain. Typically, these modifications would be made in the server implementation, but you could also create a message handler specifically for manipulating the session data. For information on creating a message handler, see Chapter 15.

The code below shows how you might modify the session data in the rwsf::CallInfo object.

//1

Create an rwsf::HttpSession object.

//2

Retrieve the rwsf::Attribute containing the rwsf::HttpSession.

//3

Shift the contents of httpSession into the rwsf::HttpSession object.

//4

Create a string object called priority.

//5

Create an rwsf::Attribute instance for the priority attribute.

//6

If this is a new session, i.e. the first request from a particular client proxy, set the value of priority to 1.

//7

If this is not the first request for a particular client, then the priority attribute has likely already been set, so get it using the getAttribute() method, and then shift its value into the string oldAttribute.

//8

If priority had been set to 1, confirming that this is not a new session, set it to 2, otherwise, set it to 1.

//9

Shift the priority value into priorityAttr.

//10

Call setAttribute() to set the priority attribute and its value.

This is all you need to do. The rwsf::HttpSession object passed around in the rwsf::CallInfo object is a handle to a body representing the session data held in the HydraExpress Agent. By making calls on the handle, you are directly changing the session data that will be returned to the client.

Note that rwsf::CallInfo has an interface that allows you to add and modify SOAP and transport header elements. This general-purpose mechanism for passing metadata between client and server is an alternative way to exchange session data. For more information, see Chapter 15.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.