Creating a Request Handler
First, we'll create a request handler to handle requests for both the client and the server. A request handler processes the message body itself.
This example uses 
rwsf::CallInfo’s 
isClient() method (
Response Handlers) to determine whether the request is client or server-based, and then either adds the SOAP header, or gets its value. Here is the included class 
SoapSecurityHandler.
 
#include <rwsf/webservice/MessageHandler.h>
 
class SoapSecurityHandler: public rwsf::MessageHandlerImp {     //1
 
  public:
 
    virtual void invoke(rwsf::CallInfo& callInfo)                     
    {
      // is this the client?
      if(callInfo.isClient()) {                                 //2
        callInfo.addRequestSoapHeader(
           rwsf::XmlName("Security"), "SomeSecurityData");
      }
      else {                                                    //3
        std::string value = callInfo.getRequestSoapHeaderValue(
          rwsf::XmlName("Security"));
        // add the value back to the response headers
        callInfo.addResponseSoapHeader(
          rwsf::XmlName("SecurityResponse"), value + ": From Server");
      }
    }
};