0 Replies Latest reply on Apr 16, 2007 9:33 AM by Peter Cankar

    Developing web services

    Peter Cankar Newbie

      Hi,

      I'm new to JBoss, trying to develop jax-ws web service. I have successfully written the same web service using java 6 embedded application server (just for testing).
      When I?m trying to use method with complex type parameter I get the following error:

      ERROR:
      ------
      [SOAPFaultExceptionHelper] SOAP request exception
      javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: javax.xml.bind.JAXBException: Failed to parse source: Requested element stevilo is not allowed in this position in the sequence. The next element should be {http://testws/jaws}stevilo

      Method with String parameter is working OK.

      Can anyone tell me what I?m doing wrong?


      WSDL:
      -----
      <definitions name='HelloBeanService' targetNamespace='http://testws/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://testws/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
       <types>
       <schema elementFormDefault='qualified' targetNamespace='http://testws/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://testws/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
       <complexType name='SimpleObj'>
       <sequence>
       <element name='stevilo' type='int'/>
       <element name='tekst' nillable='true' type='string'/>
       </sequence>
       </complexType>
      
       </schema>
       </types>
       <message name='HelloBean_testResponse'>
       <part name='result' type='xsd:string'/>
       </message>
       <message name='HelloBean_test'>
       <part name='String_1' type='xsd:string'/>
       </message>
       <message name='HelloBean_simple'>
      
       <part name='SimpleObj_1' type='tns:SimpleObj'/>
       </message>
       <message name='HelloBean_simpleResponse'>
       <part name='result' type='tns:SimpleObj'/>
       </message>
       <portType name='HelloBean'>
       <operation name='simple' parameterOrder='SimpleObj_1'>
       <input message='tns:HelloBean_simple'/>
       <output message='tns:HelloBean_simpleResponse'/>
      
       </operation>
       <operation name='test' parameterOrder='String_1'>
       <input message='tns:HelloBean_test'/>
       <output message='tns:HelloBean_testResponse'/>
       </operation>
       </portType>
       <binding name='HelloBeanBinding' type='tns:HelloBean'>
       <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
       <operation name='simple'>
      
       <soap:operation soapAction=''/>
       <input>
       <soap:body namespace='http://testws/jaws' use='literal'/>
       </input>
       <output>
       <soap:body namespace='http://testws/jaws' use='literal'/>
       </output>
       </operation>
       <operation name='test'>
      
       <soap:operation soapAction=''/>
       <input>
       <soap:body namespace='http://testws/jaws' use='literal'/>
       </input>
       <output>
       <soap:body namespace='http://testws/jaws' use='literal'/>
       </output>
       </operation>
       </binding>
      
       <service name='HelloBeanService'>
       <port binding='tns:HelloBeanBinding' name='HelloBeanPort'>
       <soap:address location='http://pcankar:8080/wsprojectapp/HelloBean'/>
       </port>
       </service>
      </definitions>
      
      
      
      HelloBean.java
      --------------
      package testws;
      import testws.Hello;
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      @Stateless
      @WebService()
      @SOAPBinding(style=SOAPBinding.Style.RPC,use=SOAPBinding.Use.LITERAL)
      public class HelloBean implements Hello {
       @WebMethod()
       public String test(String parameter){
       return "Hello world. You have called method test with parameter : " + parameter;
       }
       @WebMethod()
       public SimpleObj simple(SimpleObj vhod) {
       SimpleObj izhod = new SimpleObj();
       izhod.setStevilo(vhod.getStevilo());
       izhod.setTekst(vhod.getTekst());
       return izhod;
       }
      }
      
      Hello.java
      ----------
      package testws;
      import javax.ejb.Remote;
      @Remote
      public interface Hello {
       public String test(String parameter);
       public SimpleObj simple(SimpleObj vhod);
      }
      
      
      SimpleObj.java
      --------------
      package testws;
      public class SimpleObj {
       private String tekst="tekst";
       private int stevilo = 1;
       public int getStevilo() {
       return stevilo;
       }
       public void setStevilo(int stevilo) {
       this.stevilo = stevilo;
       }
       public String getTekst() {
       return tekst;
       }
       public void setTekst(String tekst) {
       this.tekst = tekst;
       }
      }
      
      



      Used software:
      -----------------
      JBoss 4.0.4 (jboss-4.0.4.GA-Patch1-installer.jar),
      java 5 (jdk-1_5_0_09-windows-i586-p.exe),
      Eclipse (eclipse-SDK-3.1.2-win32.zip)

      Best regards,
      Peter