2 Replies Latest reply on Sep 11, 2007 2:34 AM by jaboj

    How to make a web service with XML input?

    jaboj

      I'll like to create some web services on JBoss 4.2 which accepts a XML document/node as input for the web method. Is it possible and can anyone describe how to do it?

      One way of doing could be to create a web method which just accept a string like


      @Stateless
      public class MyWS {

      @WebMethod()
      public void acceptXml(String xml) throws WSException{
      ...
      }


      This approach required that the method converts the String to a XML Node and then do some validation against a XSD. But, is it possible to pass a XML strukture to the method instead, like:


      @WebMethod()
      public void acceptXml(Node xml) throws WSException{
      ...
      }



        • 1. Re: How to make a web service with XML input?
          heiko.braun

          Take a look at the JAX-WS Provider examples. The Provider API allows raw xml exchange.

          • 2. Re: How to make a web service with XML input?
            jaboj

            Thank you.

            Then it is possible to deploy JAX-WS style web services to JBoss? Do I need the same deployment descriptors as in the Provider sample or some specific JBoss deployment descriptors?

            My sample web service signature looks like this:


            @ServiceMode(value=Service.Mode.PAYLOAD)
            @WebServiceProvider(wsdlLocation="WEB-INF/wsdl/ProcessXml.wsdl")
            public class ProcessXmlImpl implements Provider<Source> {
            public Source invoke(Source arg0) {
            // do something and return XML Source
            }
            }