3 Replies Latest reply on Nov 15, 2006 7:31 PM by thomas.diesler

    Saving the Web Service Request as XML

    malmit

      I have been searching all over trying to figure out how to save a web service request as XML. I know that JBoss receives the XML SOAP request and translates this into the appropriate Java Object for the call, so I would assume that I can easily take that same Java Object and translate/serialize that back to XML. To me this sounds like a very simple task, but I don't seem to be able find out how to do this.

      Example:
      The method execute(MyRequest request) is called from a web service client. I want to be able to save request as XML.

      Could someone please point me in the right direction or provide the details in a reply.

      Thanks in advanced!

        • 1. Re: Saving the Web Service Request as XML
          romeufigueira

          If your're talking about saving a copy of the SOAP message on the server, then a Handler would do that for you.

          You could program your HandleResponse part of the handler to save the incoming message into a xml file.

          You will need to add the handler declaration to webservices.xml, setting your handler class (extending Handler or GenericHandler) in a separate java class (to be included in the WAR file as well).

          .....
           </service-impl-bean>
           <handler>
           <handler-name>ServiceHandler</handler-name>
           <handler-class>pakage.name.ServiceHandler</handler-class>
           </handler>
           </port-component>
           </webservice-description>
          </webservices>


          • 2. Re: Saving the Web Service Request as XML
            malmit

            Thanks this works! Does anyone know another way to serialize the Java Object to Xml within the web service implementation? I'm not sure if this is even possible.

            • 3. Re: Saving the Web Service Request as XML
              thomas.diesler

              Romeu is right, the jaxrpc handler willl do the job. With jbossws-2.0.x you will be able to use JAXB. Have a look at the JAXWS spec.