Register the Handlers
There are two ways to register your new handlers. The easiest way is to define them in the server implementation, using the macro RWSF_DEFINE_MESSAGE_HANDLER. This method is the easiest because it requires no other changes. Following is an excerpt from the supplied server implementation, HandlersImp.cpp.
 
#include "StringReverseHandler.h" //1
#include "SoapSecurityHandler.h"
 
RWSF_DEFINE_MESSAGE_HANDLER(StringReverseHandler) //2
RWSF_DEFINE_MESSAGE_HANDLER(SoapSecurityHandler)
//1 Include the handler header files.
//2 Use the RWSF_DEFINE_MESSAGE_HANDLER macro to register your handlers.
The disadvantage of the above method is that it ties the handlers to the service implementation when really they should be independent of it. One way to achieve a decoupling of the handlers from the service implementation is by declaring the RWSF_DEFINE_MESSAGE_HANDLER macros in the implementation files for the handlers themselves and compiling the handlers into a separate library.
To complete the registration of your handlers, simply add them to the handlers_objects.xml file. This file is loaded by the Agent at startup, making all objects in it available to any running service. Let’s take a look at the relevant lines in the supplied handlers_objects.xml:
 
<naming-obj> <!-- 1 -->
<naming-name>SoapSecurityHandler</naming-name>
<naming-class>HandlersService.createSoapSecurityHandler <!-- 2 -->
</naming-class>
</naming-obj>
<naming-obj>
<naming-name>StringReverseHandler</naming-name>
<naming-class>HandlersService.createStringReverseHandler
</naming-class>
</naming-obj>
//1 Add a naming-obj element for each handler. The element must include a naming-name and a naming-class attribute.
//2 The naming-class attribute is made up of library.createClass where “library” is the name of the service and the shared library (or dll on Windows), and “Class” is the name of the class to instantiate.