users@jax-rpc.java.net

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

From: Dmytro Rud <unixoid_at_web.de>
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="http://java.sun.com/xml/ns/javaee">
> <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 com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher 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 com.sun.xml.ws.handler.HandlerChainCaller.callProtocolHandlers(Unknown Source)
        at com.sun.xml.ws.handler.HandlerChainCaller.internalCallHandlers(Unknown Source)
        at com.sun.xml.ws.handler.HandlerChainCaller.callHandlers(Unknown Source)
        at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.callHandlersOnResponse(Unknown Source)
        at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.getResponse(Unknown Source)
        at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(Unknown Source)
        at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(Unknown Source)
        at com.sun.xml.ws.server.Tie.handle(Unknown Source)
        at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(Unknown Source)
        at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)
----------

How schould I add properties to avoid such exceptions?

-- 
        rnd.