5 Replies Latest reply on Feb 13, 2005 5:33 AM by Thomas Diesler

    Please Help : How to write client with complexType

    ranaaich Newbie

      Hello all,

      I'm a newbie in JBOSSWS environment. Previously I have used JBoss.net but now intend to use JBossWS.

      I have deployed a webservice(JBossWS) in jboss-4.0.1 where serviceMethod accepts a RequestType complex object in the parameter, goes to the Database - populates the ResponseType complex object and returns it. I have used wscompile to to generate the service's RMI interface and a template of the class that implements the interface. I have written custom code in the implementation file that goes to database and populates the response object.

      So far so good. I would like to write a client that will access this web-service, obtain the responseType object from the web-service call and then prints the member of ResponseType object.

      How shall I achieve this goal?

      Are there any examples on the web that shows how to write a client that access a complexType object?

      Any clue will be appreciated.

      My QueryData.xsd is as following:
      ----------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Rana Aich (Anshinsoft Corp) -->
      <xs:schema targetNamespace="urn:qs" xmlns="urn:qs" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rpc="http://www.w3.org/2003/05/soap-rpc" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
      <xs:element name="QueryDataRequest" type="QueryDataRequestType"/>
      <xs:complexType name="QueryDataRequestType">
      <xs:sequence>
      <xs:element name="epcPartial" type="xs:string"/>
      <xs:element name="userName" type="xs:string"/>
      <xs:element name="password" type="xs:string"/>
      <xs:element name="targetStore" type="xs:string"/>
      </xs:sequence>
      </xs:complexType>
      <xs:element name="QueryDataResponse" type="QueryDataResponseType"/>
      <xs:complexType name="QueryDataResponseType">
      <xs:sequence>
      <xs:element name="epc" type="xs:string"/>
      <xs:element name="maxthreshold" type="xs:int"/>
      <xs:element name="minthreshold" type="xs:int"/>
      <xs:element name="overstock" type="xs:int"/>
      <xs:element name="status" type="xs:int"/>
      </xs:sequence>
      </xs:complexType>
      </xs:schema>

      --------------------------------------------------------------------------------

      The QueryData.wsdl :

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:qs="urn:qs" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">


      <xs:schema>
      <xs:import namespace="urn:qs" schemaLocation="./xsds/QueryData.xsd"/>
      </xs:schema>

      <wsdl:message name="getQueryDataResponse">

      <wsdl:part name="getQueryDataResponse" type="qs:QueryDataResponseType"/>

      </wsdl:message>

      <wsdl:message name="getQueryDataRequest">

      <wsdl:part name="in0" type="qs:QueryDataRequestType"/>

      </wsdl:message>

      <wsdl:portType name="QueryData">

      <wsdl:operation name="getQueryData" parameterOrder="in0">

      <wsdl:input name="getQueryDataRequest" message="impl:getQueryDataRequest"/>

      <wsdl:output name="getQueryDataResponse" message="impl:getQueryDataResponse"/>

      </wsdl:operation>

      </wsdl:portType>

      <wsdl:binding name="QueryDataSoapBinding" type="impl:QueryData">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getQueryData">

      <wsdlsoap:operation soapAction=""/>

      <wsdl:input name="getQueryDataRequest">

      <wsdlsoap:body use="literal" namespace="http://DefaultNamespace"/>

      </wsdl:input>

      <wsdl:output name="getQueryDataResponse">

      <wsdlsoap:body use="literal" namespace="http://DefaultNamespace"/>

      </wsdl:output>

      </wsdl:operation>

      </wsdl:binding>

      <wsdl:service name="QueryDataService">

      <wsdl:port name="QueryData" binding="impl:QueryDataSoapBinding">

      <wsdlsoap:address location="http://localhost:8080/ws4ee/services/QueryData"/>

      </wsdl:port>

      </wsdl:service>

      </wsdl:definitions>