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

16.3 Example

HydraExpress ships with the example <installdir>\tutorials\webservices\Headers. In this directory you will find a WSDL file, headers.wsdl, a server implementation, HeadersImp.cpp, and a client implementation, HeadersClient.cpp.

16.3.1 Client-Side Code

The client implementation of the invoke_addHeaders() method, which calls the addHeaders() service operation method in the proxy, adds a SOAP header to a rwsf::CallInfo object before sending the request message.

//1Instantiates a rwsf::CallInfo object.
//2Adds a request SOAP header element named MyHeader, in a namespace with the prefix headers, whose value is the literal string "MyValue".
//3Calls the addHeaders() method in the proxy, passing the rwsf::CallInfo object containing the header data.

16.3.2 Server-Side Code

On the server side, the implementationHeadersImp.cpp retrieves the header data and adds a new header to the response message whose data is a modified version of the data in the request message header.

//1Retrieves the header data into the variable headerValue.
//2Adds a response SOAP header element named ServerHeader, in a namespace with the prefix headers, whose value is the request header data with the literal string ": From the server" appended.

16.3.3 Viewing the Results

Generate code, build the example (making sure to copy the provided client and server implementations to the app\client and app\server directories respectively), and deploy the server. If you need help, see the procedure in Chapter 3, "Creating a Web Service."


The provided implementations assume you have generated code using the default -STL option. If you use the -sourcepro option, the provided implementations will fail to compile.

From your command prompt, navigate to your HeadersExample\bin directory where the client executable has been placed.


HydraExpress's generated client sample implementations all point to the <project-directory>\conf directory to locate the client configuration files. If you move the client executable without maintaining the same code generation directory structure, or you invoke the client from another location, be aware that you must edit the client implementation to maintain the correct path to the conf directory.

Run the example by entering:

The output shows the header data as returned from the server:

The output is generated by these lines in the client implementation:

To see the SOAP header as added to the request message by the client and as added to the response message by the server implementation, look at the log file log.out in the directory where you ran the example. The log shows the request SOAP message:

Here is the response:



Previous fileTop of DocumentContentsIndex pageNext file

©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.