5 Replies Latest reply on Dec 6, 2011 8:41 AM by paul.robinson

    add context-handlers.xml

    ppoliani

      As i read in the development guide about ws-atomic tramsaction, i have ti register the JAX-WS server-side context handler with the deployed web services. As i understand, i have to include the context-handler.xml file into the project and then use the javax.jws.HandlerChain annotation.

       

      I develop my servives following the WSDL to java approach and build the project with maven in eclipse. How can i accomplish this task. I have been searching but could not find anything.

       

      I managed to register my client for the transaction (following the example provided with jbossTS), however i am strugling to do the same for the service.

       

      When the clients calls the service, i get the following exception:

       

       

      javax.xml.ws.soap.SOAPFaultException: MustUnderstand headers: [{http://docs.oasis-open.org/ws-tx/wscoor/2006/06}CoordinationContext] are not understood.
           org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:84)
           org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)
           org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:579)
           org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
           org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
           org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
           org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
           $Proxy572.checkFlightAvailability(Unknown Source)
           org.comp6017.JaxWsClient.Client.testTransaction(Client.java:247)
           org.comp6017.JaxWsClient.Client.doGet(Client.java:185)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
        • 1. Re: add context-handlers.xml
          paul.robinson

          Pavlos,

           

          Take a look at this example service implementation:

           

          http://anonsvn.jboss.org/repos/labs/labs/jbosstm/trunk/XTS/demo/src/com/jboss/jbosstm/xts/demo/services/restaurant/RestaurantServiceAT.java

           

          Here you will see the following class-level annotation:

           

           @HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")
          

           

          This is how you specify which handler chain to use on the client side. You need to ensure that the context-handlers.xml file is available inside your deployment archive at the classpath location, specified in the annotation. For a war, the file should be located under  /WEB-INF/classes.

           

          Here's an example of the context-handlers.xml file:

           

          http://anonsvn.jboss.org/repos/labs/labs/jbosstm/trunk/XTS/demo/dd/jboss/context-handlers.xml

           

          Paul.

          • 2. Re: add context-handlers.xml
            ppoliani

            Hi Paul,

             

            Actually i have examined the examples provided in the jbossts demo. The issue in my case is that i use the wsdl to java approach, where i cannot insert the @HandlerChain(file = "/context-handlers.xml", name = "Context Handlers") annotation in my code. Is there a way to register the service-side handler chain, inside my code, like i did in my client?

             

            As i noticed, the SOAP handler is the class com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor, which obviously will integrate the coordination context into the soap messages. My question is how to explicitely add this handler without using the @handlerchain annotation.

            • 3. Re: add context-handlers.xml
              ppoliani

              Hi paul,

               

              Again me. I followed your instructions. I added the @HandlerChain(file = "/context-handlers.xml", name = "Context Handlers") annotation. But know i get the following exception

              when i try to deploy the service:

               

               

              21:45:12,790 ERROR [ContextLoader] Context initialization failed
              org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FlightService': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [java.util.List] for property 'handlers'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor] to required type [javax.xml.ws.handler.Handler] for property 'handlers[0]': no matching editors or conversion strategy found
              

               

              what is wrong with that. I understand what the exception means but i don't to know how to solve it.

              • 4. Re: add context-handlers.xml
                ppoliani

                To be honest, the error that i mentioned above appeared when i tried to add the hadler chain via the appcontext.xml file of the Spring framework. I followed the instructions from this link: http://cxf.apache.org/docs/jax-ws-configuration.html

                 

                Then i tried to do the same task, but using the annotation approach now(the one you suggested). However i get the following exception:

                 

                Caused by: java.lang.ClassCastException: class com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor
                     at java.lang.Class.asSubclass(Class.java:3018)
                     at org.apache.cxf.jaxws.handler.HandlerChainBuilder.buildHandlerChain(HandlerChainBuilder.java:121)
                

                this is the root of the exception.

                • 5. Re: add context-handlers.xml
                  paul.robinson

                  Pavlos,

                   

                  This is a known issue:

                   

                  https://issues.jboss.org/browse/JBTM-911

                  http://community.jboss.org/message/629328#629328

                   

                  This is one of the issues that I was referring to when I said you would have problems if you used a version of JBoss AS 7, prior to 7.1.0.beta1b.

                   

                  You should upgrade to JbossAS 7.1.0.beta1b to fix this problem and a number of other issues with XTS.

                           

                  Paul.

                  1 of 1 people found this helpful