6 Replies Latest reply on Mar 28, 2007 12:31 PM by jason.greene

    wsconsume with provider sample

    superomega

      Hallo

      I use JBossWS 1.2.0 GA and want to test the ..../jaxws/samples/provider example. (JBoss 4.0.5 GA)

      After I have compiled the given wsdl with /opt/jboss/bin/wsconsume.sh

      <?xml version='1.0'?>
      <definitions name='ProviderService' targetNamespace='http://org.jboss.ws/provider' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.jboss.ws/provider' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
       <types>
       <xs:schema targetNamespace='http://org.jboss.ws/provider' xmlns:tns='http://org.jboss.ws/provider' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
       <xs:element name='user' type='tns:UserType'/>
       <xs:complexType name='UserType'>
       <xs:sequence>
       <xs:element name='string' type='xs:string'/>
       <xs:element name='qname' type='xs:QName'/>
       </xs:sequence>
       </xs:complexType>
       </xs:schema>
       </types>
       <message name='echo'>
       <part element='tns:user' name='user'/>
       </message>
       <message name='echoResponse'>
       <part element='tns:user' name='user'/>
       </message>
       <portType name='Provider'>
       <operation name='echo'>
       <input message='tns:echo'/>
       <output message='tns:echoResponse'/>
       </operation>
       </portType>
       <binding name='ProviderBinding' type='tns:Provider'>
       <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
       <operation name='echo'>
       <soap:operation soapAction=''/>
       <input>
       <soap:body use='literal'/>
       </input>
       <output>
       <soap:body use='literal'/>
       </output>
       </operation>
       </binding>
       <service name='ProviderService'>
       <port binding='tns:ProviderBinding' name='ProviderPort'>
       <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
       </port>
       </service>
      </definitions>
      


      I got a WebMethod like this: (Provider.java)

       @WebMethod
       public void echo(
       @WebParam(name = "user", targetNamespace = "http://org.jboss.ws/provider", mode = WebParam.Mode.INOUT, partName = "user")
       Holder<UserType> user);
      


      But I thought that I shoud get back a UserType isn't this correct?
      What do I have overlooked?

      Greet,
      Werner


        • 1. Re: wsconsume with provider sample
          superomega

          Hallo again,

          the question was for this example:
          Why do I get a void type as result of the method and not a result value from type user?

          Greets,
          Werner

          • 2. Re: wsconsume with provider sample
            gymdaues

            I have the equivalent question on the client side.
            wsconsume generates web service client stubs that return void
            and use Holder as output args of the method.
            it can work, but sure is ugly and inconvenient.

            can one make it generate a more reasonable client interface?

            • 3. Re: wsconsume with provider sample
              gymdaues

              superomega - the trick is to use custom jaxws bindings.

              e.g. jaxws-bindings.xml

              <jaxws:bindings
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
               xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
               xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
               wsdlLocation="http://blahblah?wsdl">
               <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
              </jaxws:bindings>


              and then

              wsconsume -b jaxws-bindings.xml <wsdl-url>


              • 4. Re: wsconsume with provider sample
                jason.greene

                Just so you guys know the reason this is happening is that the response and request element have the same name, so per the spec, a Holder is used.

                -Jason

                • 5. Re: wsconsume with provider sample
                  gymdaues

                  thanks Jason.
                  that is true for superomega's example
                  but is not for mine

                  <message name="TestComposite_getSimilarStructuresResponse">
                   <part element="tns:getSimilarStructuresResponse" name="getSimilarStructuresResponse" />
                   </message>
                  <message name="TestComposite_getSimilarStructures">
                   <part element="tns:getSimilarStructures" name="getSimilarStructures" />
                   </message>



                  • 6. Re: wsconsume with provider sample
                    jason.greene

                    Right so in his case he has a bare style service since it is using the same type definition for request/response (does not qualify for wrapped). Yours does qualify for wrapped, so I am guessing you are seeing holders because getSimilarStructures and getSimilarStructuresResponse schema types share the same internal elemnt names.

                    -Jason