9 Replies Latest reply on Dec 18, 2007 10:06 AM by jpechanec

    Contents of the SOAP request

    jpechanec

      Hi,

      I need to call a Web Service but by sending the SOAP request via JMS.
      Is it possible if I have enpoint intiated from WSDL not to call the service itself but generate only String representation of the SOAP call?

      Thanks in advance

      Jirka

        • 1. Re: Contents of the SOAP request
          thomas.diesler

          We message driven bean endpoints. They do receive a SOAPMessage that can be serialized into a string. Is this what you need?

          • 2. Re: Contents of the SOAP request
            jpechanec

            I need the serialization at the client side, not server side. I need to convert the SOAP call to String and sent it via JMS to ESB or for example I need only to display what message would be sent without actually sending it.

            J.

            • 3. Re: Contents of the SOAP request
              thomas.diesler

              A client side handler can do this for you. You would return false from handleMessage and do with the SOAP message whatever you like.

              • 4. Re: Contents of the SOAP request
                jpechanec

                Thanks for the response, this approach works. But I hit another problem. I am also applying WS-S rules on message and in handler I am getting plain SOAP without WSS rules applied. Is it possible that I will receive message even with security handlers and encrypted?

                Thanks

                J

                • 5. Re: Contents of the SOAP request
                  thomas.diesler

                  It simply depends on the order of the handlers. i.e. if your handler comes before the wsse handler you won't have wsse and vice versa

                  • 6. Re: Contents of the SOAP request
                    jpechanec

                    OK,

                    I tried two approaches
                    1) use typecasting to StubExt and set security config. Then security works OK, but my handler is called before message is enriched with security elements
                    2) I used handlerChain.add(new org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient()); In this case my handler was called after the security one. The WS was successfully invoked but when the service returned result, the client thrown an exception SOAP request exception
                    [testng] org.jboss.ws.WSException: Cannot find child element: return
                    Apparently the client did not processed WSS headers

                    So I am looking for one of the two solutions
                    1) Force client to first process security set via StubExt and then the process handlers (preferred)
                    2) Or enable the second approach working. maybe I need to add another handler that will process the response separately?

                    Thanks in advance

                    J

                    • 7. Re: Contents of the SOAP request
                      asoldano

                      An explanation that may help, hope it's not too late.
                      The reason why your first approach results in your handler being called before the wsse one is that the latter is configured as a post-handler while yours is an endpoint-handler. You would need your handler to be a post-handler, however afaik this can only be achieved editing the jbossws configurations in standard-jaxws-client-config.xml.

                      Speaking of the second approach, where did you do that call? where is the handlerChain instance from?

                      • 8. Re: Contents of the SOAP request
                        thomas.diesler

                         


                        can only be achieved editing the jbossws configurations in standard-jaxws-client-config.xml.


                        you can also supply your own config file

                        • 9. Re: Contents of the SOAP request
                          jpechanec

                          Hi,
                          thanks for your answers. I have done fast and dirty solution

                           // Generate the SOAP xml
                           StringWriter messageString = new StringWriter();
                           List<Handler> handlerChain = bindingProvider.getBinding().getHandlerChain();
                           handlerChain.add(new org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient());
                           handlerChain.add(new TestHandler(messageString));
                           bindingProvider.getBinding().setHandlerChain(handlerChain);
                           UserType userType = new UserType();
                           userType.setMsg(TEST_MESSAGE);
                           UserType retObj = hello.echoUserType(userType);
                          
                           // Actually call the WS
                           bindingProvider.getBinding().setHandlerChain(new ArrayList<Handler>());
                           ((StubExt) hello).setSecurityConfig("jboss-wsse-client.xml");
                           ((StubExt) hello).setConfigName("Standard WSSecurity Client");
                           retObj = hello.echoUserType(userType);
                          


                          This approach worked albeit it is really crude