Re: JAX-WS 2.0: SOAP handlers don't work

From: Dmytro Rud <>
Date: Thu, 6 Oct 2005 12:56:47 +0200 (CEST)

Bobby Bissett <Robert.Bissett_at_Sun.COM> writes:

>> I wrote a web service with a server side SOAP handler using
>> JAXWS_SI_20050929 and deployed it on Apache Tomcat 5.5.9. There are
>> no error messages in Tomcat logs and client applications work too,
>> but the handler doesn't work, as if its methods were simply not
>> called at all. What do I make wrong?
> You probably did nothing wrong -- the schema for the handler files has
> changed, but the examples have not caught up yet (I'll change them
> today).
> Try this for your handle chain file:
> <handler-chains xmlns="">
> <handler-chain>
> <handler>
> <handler-class>service3.handlers.SimpleHandler</handler-class>
> </handler>
> </handler-chain>
> </handler-chains>
> instead of:
>> ----
>> <?xml version="1.0" encoding="UTF-8"?>
>> <handler-config>
>> <handler-chain>
>> <handler-chain-name>Chain1</handler-chain-name>
>> <handler>
>> <handler-class>service3.handlers.SimpleHandler</handler-class>
>> </handler>
>> </handler-chain>
>> </handler-config>
> Let me know if that works for you.

It works, thank you. How can I specify the name of the handler chain in
the new schema? Is this conception (name) obsoleted now?

And another question: I want to put a new property into a
SOAPMesageContext using the following lines in handleMessage():

Boolean outbound = ( Boolean )context.get( MessageContext.MESSAGE_OUTBOUND_PROPERTY );
if( ! outbound.booleanValue()) {
    context.put( "arrival_timestamp",new Long( System.currentTimeMillis()));
} else {
    // get dispatch timestamp and calculate the difference

but in context.put() occurs the following exception (excerpt from Tomcat logs):

06.10.2005 12:25:26 getResponse
SEVERE: javax.xml.namespace.QName
java.lang.ClassCastException: javax.xml.namespace.QName
        at service3.handlers.TimeMeasurementHandler.handleMessage(Unknown Source)
        at service3.handlers.TimeMeasurementHandler.handleMessage(Unknown Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at$SoapInvoker.invoke(Unknown Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at javax.servlet.http.HttpServlet.service(
        at javax.servlet.http.HttpServlet.service(
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
        at org.apache.catalina.core.StandardWrapperValve.invoke(
        at org.apache.catalina.core.StandardContextValve.invoke(
        at org.apache.catalina.core.StandardHostValve.invoke(
        at org.apache.catalina.valves.ErrorReportValve.invoke(
        at org.apache.catalina.core.StandardEngineValve.invoke(
        at org.apache.catalina.connector.CoyoteAdapter.service(
        at org.apache.coyote.http11.Http11Processor.process(
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(
        at org.apache.tomcat.util.threads.ThreadPool$

How schould I add properties to avoid such exceptions?