7 Replies Latest reply on May 4, 2012 4:37 AM by mageshbk

    HandlerChain in SwitchYard configuration

    ibek

      Hi, is it possible to set a handlerChain in SwitchYard configuration (switchyard.xml)? I know that Web Services can be annotaded with @HandlerChain , but it would be great to make it possible even in the configuration because I would like to set some handlers for BPEL component but AFAIK it is not possible yet so I was thinking about that it could be set in the configuration.

        • 1. Re: HandlerChain in SwitchYard configuration
          mageshbk

          Hi Ivo,

           

          I am not quite sure If I understood your requirement. Do you want to manipulate how messages are composed from a WebService gateway binding? If so then you can use the binding's message composition feature.

          • 2. Re: HandlerChain in SwitchYard configuration
            ibek

            Hi Magesh,

             

            thank you, I can try it, but I'm not sure if it will work. I need to set the com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor handler for a BPEL process, the handler "clears" mustUnderstand attribute from a coordination context in a SOAP message header. It must be set because otherwise the mustUnderstand attribute stays in the SOAP header and JAX-WS implementation (CXF or JBossWS) throws exception because it looks then like the service doesn't support the coordination context. (http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.narayana.xts/jbossxts/5.0.0.M1/com/arjuna/mw/wst11/service/JaxWSHeaderContextProcessor.java) getHeaders function makes the support of that.

             

            If I create my own context mapper and use it, I'm afraid that it is too late to change something because AFAIK the mapTo function is performed after the invocation which won't happen because of the mustUnderstand attribute.

            • 3. Re: HandlerChain in SwitchYard configuration
              mageshbk

              Ivo,

              the handler "clears" mustUnderstand attribute from a coordination context in a SOAP message header.

               

              If I create my own context mapper and use it, I'm afraid that it is too late to change something because AFAIK the mapTo function is performed after the invocation which won't happen because of the mustUnderstand attribute.

              You create a custom MessageComposer and clear the header there.

              • 4. Re: HandlerChain in SwitchYard configuration
                ibek

                Hi Magesh,

                 

                as I thought a message composer with context mapper is not called before the exception ([org.apache.cxf.phase.PhaseInterceptorChain] (pool-10-thread-1) Interceptor for {http://www.jboss.org/bpel/examples}BusinessTravelService#{http://www.jboss.org/bpel/examples}order has thrown exception, unwinding now: org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers: [{http://docs.oasis-open.org/ws-tx/wscoor/2006/06}CoordinationContext] are not understood.),

                 

                When I use soapui, the SOAP message is sent even with the mustUnderstand attribute without any problems, but if I want to use proxy objects to invoke, it seems that cxf checks this itself with some interceptor on the application server and because the handler is not registred, it throws the exception on the client side. Is it possible to set the interceptor chain (PhaseInterceptorChain, ...) in general in the java code? Because I would like to support even another JAX-WS implementation than only CXF or can I presume that the CXF will be always part of JBoss AS7 or switchyard? I found some nice tests which could be usefull but only for the CXF http://jbi4corba.sourceforge.net/xref-test/it/imolinfo/jbi4corba/test/cxf/CXFConsumerTest.html

                PhaseInterceptorChain outInterceptorChain = new PhaseInterceptorChain(CXFUtils.getBus().getExtension(PhaseManager.class).getOutPhases());

                ...

                 

                • 5. Re: HandlerChain in SwitchYard configuration
                  mageshbk

                  Could you attach your sample with the custom composer here for me to have a look? A mock request with that SOAP Header should do.

                   

                  ATM, the SwitchYard's SOAP binding uses the standard JAX-WS API internally to publish and invoke Webservices. It is not tied to CXF. So, if any JAX-WS compliant implementation is used it would work in Tomcat or even a standalone JDK.

                   

                  Regarding the handlers in configuration, please open a JIRA or I will do so to address this in our future release.

                  • 6. Re: HandlerChain in SwitchYard configuration
                    ibek

                    I'm sorry I cannot attach the sample because I tried it with the SOAPContextMapper where I only added some log information into mapFrom method. So I saw the SOAP header details when the message contained the coordination context with mustUnderstand attribute if I sent the SOAP message from soapui, but for calling proxy objects nothing appear in the server log.

                     

                    Ok, I have just created the feature request for that (SWITCHYARD-756), thanks for help.

                    • 7. Re: HandlerChain in SwitchYard configuration
                      mageshbk

                      Thanks Ivo! You should be able to write a MessageComposer that removes the header elements from the SOAPHeader, that is what I thought you did.