Java Reference
In-Depth Information
Intercepting the Request to Perform Work on Your
Payload
Problem
You want to access or modify only the payload of your request or response by intercepting it,
and you don't want to bake this code into your message construction. You're not interested in
the protocol wrapper, such as the SOAP envelope.
Solution
Use a LogicalHandler by implementing the javax.xml.ws.handler.LogicalHandler in-
terface.
Discussion
Logical handlers are useful if you need to operate only on the payload of a message, whether
you are using SOAP or REST. They are also the appropriate choice if you want to use JAXB
for processing the message payload.
The framework for logical handlers is similar to that for protocol handlers, so for more back-
ground you may want to also read Intercepting the Request to Perform Protocol-Specific
Work , in particular the sidebar More About Handlers .
The printMetaData method illustrates that even in a logical handler you can get access to
certain aspects of the transport, and understand a lot about the message you're working with.
The result of running the code for the meta data print method looks like this on a response for
the client (inbound message):
********** HEADERS:
List of headers for Transfer-encoding: [chunked]
List of headers for null: [HTTP/1.1 200 OK]
List of headers for Content-type: [text/xml;charset="utf-8"]
List of headers for Server: [Sun Java System Application Server 9.1_01]
List of headers for X-powered-by: [Servlet/2.5]
List of headers for Date: [Thu, 15 May 2008 17:02:12 GMT]
********** RESPONSE CODE: 200
********** ATTACH: {}
Search WWH ::




Custom Search