 |
Understanding Handlers in JAX-WS
Posted by ramapulavarthi on May 01, 2006 at 10:06 AM | Comments (6)
JAX-WS provides a pluggable framework to extend the runtime processing capabilities through handlers. Handlers are message interceptors that can do pre-processing/post-processing of the messages to complement your Web Service. JAX-WS defines two types of handlers, logical handlers and protocol handlers. Protocol handlers are specific to a protocol and may access or change the protocol specific aspects of a message. Logical handlers are protocol-agnostic and act only on the payload of the message.
In this article "A little about Handlers in JAX-WS", I explain the differences between logical and SOAP handlers, and show examples to write a simple handler. The following diagram shows the differences in the message context accessible to these handlers.
The SOAPLoggingHandler shows how one can log inbound and outbound soap messages using a SOAP handler. In the same lines, I showed a LogicalLoggingHandler to show how one can use logical handler to process the payload of the message. The following diagram shows how SOAP handlers and logical handlers plug in to the JAX-WS runtime.
Find more about this in the article. I hope this article helps you in understanding handlers and get you started.
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Hi!
Thanks for the article, it's quite comprehensible.
What I wonder is how I "deploy" the handler. I guess there are some fancy annotations for these handlers, too? Or just how do I tell my WebService that a handler should be applied?
sebastian
Posted by: sebastiankirsch on May 02, 2006 at 08:36 AM
-
I am planning to write an article on configuring handlers in JAX-WS explaining that. For now, you can follow the fromwsdlhandler and fromjavahandler samples in JAX-WS RI bundle.
Posted by: ramapulavarthi on May 02, 2006 at 11:39 AM
-
Hi,
I am a Java Instructor,investigating jax-ws technology.
Your article metions that, for logical handlers, one can do
logicalMessage.getPayload(someJAXBContext);
looks very interesting, but where does one get this
''someJAXBContext'' form in the first place?
Luc
Posted by: lucduponcheel on November 16, 2006 at 09:15 AM
-
btw: if somebody has an answer, then, also post it to
luc.duponcheel@accenture.com
I'm not reading blog's on a daily basis ...
Posted by: lucduponcheel on November 16, 2006 at 09:18 AM
-
Hi all,
no need to reply anymore: found it all out myself,
-- begin code excerpt ---
if (outboundProperty) {
JAXBContext jaxbContext = null;
try {
jaxbContext
= JAXBContext.newInstance("webservice.tracking");
} catch (JAXBException ex) {
ex.printStackTrace();
}
JAXBElement jaxbElement
= (JAXBElement) logicalMessage.getPayload(jaxbContext);
GetDetailResponse getDetailResponse
= (GetDetailResponse) jaxbElement.getValue();
Order order = getDetailResponse.getReturn();
order.setCustomerID(9999);
logicalMessage.setPayload(jaxbElement, jaxbContext);
}
-- end code excerpt ---
sorry
Luc
Posted by: lucduponcheel on November 16, 2006 at 12:00 PM
-
Is there some way to programatically set the handlers on a Dispatch service without having to create an XML descriptor file?
Posted by: jbarnum on March 16, 2008 at 08:42 PM
|