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)
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>