6 Replies Latest reply: Aug 25, 2010 8:19 AM by 792247 RSS

    JAXWS SOAP Handler not kicking in - using weblogic 10.3.3

    791717
      We are currently in the process of migrating to weblogic and have a JAXWS webservice with a SOAP handler - using the HandlerChain annotation on the web service - somehow the handler never kicks in!!! I can see the getHeaders method being called - the handler is registered on the webservice - but the handleMessage() is never called nor any of the other methods!


      Looking for some help or any clues on what could be going on?? Do we need to use the jwsc tool to generate the classes - since we're not using that tool - thats the only difference. Or does it have to be in a WAR context since we just have a plain EJB with the annotations!


      Please let me know if anyone has any idea or have gone through something similar.

      Edited by: user9050416 on Aug 16, 2010 12:34 PM

      Edited by: user9050416 on Aug 18, 2010 11:29 AM

      Edited by: user9050416 on Aug 18, 2010 11:29 AM
        • 1. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
          791717
          any idea anyone? We're almost at the point of abandoning the use of Handlers - its so strange as this is standard technology it should work in any app server.. quite frustrating!!
          • 2. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
            792247
            Hi,

            I'm going through some similar right now :) Don't give up!

            I have almost the same problem but with significant difference that my handler absolutely doesn't work. The @HandlerChain(...) annotation seems to be fully ignored during the deployment phase. I'm neither able to find any hint inside of server's log file about chain handler deployment (deployment stuff is set to log debug mode) nor I can see the handler deployed in the administration console. My endpoint configuration looks like:

            @WebService(serviceName = "AIMSLService", targetNamespace = "http://aimsl.com/ws", portName = "AIMSLServicePort", wsdlLocation = "WEB-INF/wsdl/WS.wsdl")
            @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE, use = SOAPBinding.Use.LITERAL)
            @HandlerChain(file = "WEB-INF/legalRecordingHandler.xml")
            @WssConfiguration("WFSSecurityConfiguration")
            @Policies( {
                      @Policy(uri = "policy:Wssp1.2-2007-Wss1.1-UsernameToken-Plain-X509-Basic256.xml"),
                      @Policy(uri = "policy:Wssp1.2-2007-SignBody.xml", direction = Policy.Direction.both) })
            public class AIMSLServiceImpl {

            ...


            My handler chain configuration file (legalRecordingHandler.xml) is the trivial one from the documentation and looks like:

            <?xml version="1.0" encoding="UTF-8" ?>
            <jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee">
            <jws:handler-chain>
            <jws:handler>
            <jws:handler-class>com.aimsl.service.LegalRecordingHandler</jws:handler-class>
            </jws:handler>
            </jws:handler-chain>
            </jws:handler-chains>


            Like you I don't use jwsc tool to generate any classes/artifacts. It is just a tool and I don't believe that it does matter if annotations and xml descriptors are ok.

            Maybe you should post your relevant artifacts, too.

            best regards,
            Aleks
            • 3. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
              791717
              Hi Aleks!
              Glad to hear someone else is hitting the issue as well.

              On our side the service looks like this - its a Stateless EJB published as a webservice.

              @Stateless(name = "AI-AuditManager")
              @Local(AuditManagerLocal.class)
              @Remote(AuditManagerRemote.class)
              @WebService(name = "AuditManager", serviceName = "AuditService", targetNamespace = "http://jaxws.audit.frontend.service.ai.com")
              @HandlerChain(file = "LoginHandlerChain.xml")
              public class AuditManagerBean implements AuditManagerLocal, AuditManagerRemote {


              the handler chain looks like the following:
              <?xml version="1.0" encoding="UTF-8"?>
              <jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
                   <jws:handler-chain name="LoginHandlerChain">
                        <jws:handler>
                             <jws:handler-class>com.ai.service.handler.LoginHandler</jws:handler-class>
                        </jws:handler>
                   </jws:handler-chain>
                   
              </jws:handler-chains>


              We were able to see the handler registerd by using two things:
              1. If the handler chain file is exactly in that location as your webservice class - i couldn't figure out the relative path but if the handler.xml file is in the same location as your webservice and you use the handler chain annotation as:
              @HandlerChain(file = "LoginHandlerChain.xml") - u can actually see it registered. We tried relative paths but that didn't work for us. After this we could see any logs from the constructor or getHeaders() method. But the rest of the methods were not invoked.

              2. You can use META-INF/webservices.xml file to define your handler chain as well. You can remove the HandlerChain annotation or leave it and use the following in the webservices.xml - this way also we see the handler registered and getHeaders being invoked:

              <?xml version='1.0' encoding='UTF-8'?>
              <webservices xmlns="http://java.sun.com/xml/ns/javaee"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                   http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd"
                        version="1.2">
                   <webservice-description>
                        <webservice-description-name>AuditManagerService</webservice-description-name>
                        <port-component>
                             <port-component-name>AuditManagerPort</port-component-name>
                             <wsdl-port xmlns:jax="http://jaxws.audit.frontend.service.ai.com">jax:AuditManagerPort</wsdl-port>
                             <service-impl-bean>
                                  <ejb-link>AI-AuditManager</ejb-link>
                             </service-impl-bean>
                             <handler-chains>
                                  <handler-chain>
                                       <handler>
                                            <handler-name>Login Handler</handler-name>
                                            <handler-class>com.ai.service.handler.LoginHandler</handler-class>
                                       </handler>
                                  </handler-chain>
                             </handler-chains>
                        </port-component>
                   </webservice-description>
              </webservices


              Hope this helps!! and please share if you do find a solution!
              • 4. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
                792247
                Hi,

                The approach you proposed lead me to the same result as you already mentioned. The handler chain seems to be registered (yeah such trivial result after so many days playing around with a stuff which should work immediately) and now it's visible in the admin console but it still doesn't work as expected. I'm sure that we discovered the bug in the WLS JAX-WS implementation.

                The solution I could propose would be to construct custom request interceptor using another web service with @WebServiceProvider annotation and the WSDL file you already use for your real web service. Such endpoint would accept every SOAP message you send so you would need to redirect your service calls to that end point, process incoming SOAP message inside (using SAAJ) and finally invoke your real web service using dynamic invocation approach:


                @WebServiceProvider(
                          targetNamespace="http://some-ns.com/ws",
                          serviceName = "Service",
                          portName = "LServicePort",
                          wsdlLocation = "WEB-INF/wsdl/OriginalService.wsdl")
                @BindingType(value = HTTPBinding.HTTP_BINDING)
                @ServiceMode(value=Service.Mode.MESSAGE)

                public class FakeWSHandler implements Provider<SOAPMessage> {

                     public SOAPMessageinvoke(Source SOAPMessage) {
                // process SOAPMessage like the handler would do, invoke your real web service, get the response document, convert to response SOAPMessageand return bask to requestor
                }
                          
                }

                Regards,
                Aleks
                • 5. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
                  791717
                  Hi Aleks,

                  we were able to actually resolve our issue and move forward!! It seems the weblogic-application.xml file had this entry which was causing the issue:

                  <prefer-application-resources>
                            <resource-name>META-INF/services/*</resource-name>
                  </prefer-application-resources>

                  this led to the jaxws handlers not getting invoked...

                  So maybe this is your problem as well?
                  • 6. Re: JAXWS SOAP Handler not kicking in - using weblogic 10.3.3
                    792247
                    Hi,

                    Yes, thank to your hint I was able to get it work, too. I don't have ear and no weblogic-application.xml at all. My web services are placed within a war file in its "classes" folder. For the first time I thought that I have to put the handler chain descriptor directly in the folder "classes". It wasn't work for me but as s soon as I put it exactly in same folder/package where the target SEI class was placed the handler started to work.

                    Again on WLS 10.3.3 with SEI classes packed in a WAR archive the only way to get the handler chain to work (at least for me):


                    package com.aimsl.service;

                    ...

                    @WebService(...)
                    @HandlerChain(file = "legalRecordingHandler.xml")
                    public class WSServiceImpl {

                    ...

                    The class WSServiceImpl and handler chain descriptor both have to be placed in the WEB-INF/classes/com/aimsl/service!

                    If you prefer to put the legalRecordingHandler.xml in WEB-INF/classes you have to modify the annotation attribute:


                    @WebService(...)
                    @HandlerChain(file = "../../../legalRecordingHandler.xml")
                    public class WSServiceImpl {

                    ...


                    The annotation @HandlerChain(file = "WEB-INF/legalRecordingHandler.xml") in case of putting the descriptor in the WEB-INF (as it was suggested in the WLS tutorial) doesn't work for me!

                    best regards and thanks for help,
                    Aleks

                    Edited by: aleksb on Aug 25, 2010 1:15 AM

                    Edited by: aleksb on Aug 25, 2010 1:19 AM