Response Handlers
On the server, response handlers are invoked on outgoing responses immediately before the transport handlers are invoked; on the client, they are invoked immediately after the transport handlers have been invoked. See
Figure 8.
On the server, the SOAP message handler generated by HydraExpress is always invoked on the outgoing message as the
last response handler before the transport handlers. This is true even though it does not appear in the
<response-handlers> element of the handlers configuration file,
<servicecontextname>_handlers.xml (used to configure server-side handlers and discussed in
Chaining Handlers on the Server).
A single SOAP message handler can function either as a request message handler, a response message handler, or both. The
rwsf::CallInfo interface provides methods for determining whether the message is a request or response.
The
rwsf::CallInfo::isRequest() method returns
true for a request message, causing the SOAP message handler to parse the message as an incoming request. This method returns
false for a response message, causing the SOAP message handler to construct the SOAP response message. You, too, can use this method to create a handler that serves as both a request and a response handler, but note that such custom handlers must be configured in both the
<request-handlers> and
<response-handlers> elements of
<servicecontextname>_handlers.xml, discussed in
Chaining Handlers on the Server.
In fact,
rwsf::CallInfo also has an
isClient() method that returns true on the client side and false on the server side. With this method, a single handler could be used for both request and response handling on both the client and the server.