users@jax-rpc.java.net

Re: Return an array of objects

From: trebor iksrazal <iksrazal_at_yahoo.com>
Date: Wed, 7 Sep 2005 06:56:18 -0700 (PDT)

We'll see what we can come up with. If your going to
have an array of objects, you seem to be missing a few
steps in the wsdl - the way I usually do it. Try the
following (hand coded, not tested).

<complexType name="ReturnAlarm">
        <complexContent>
            <sequence>
              <element name="list"
type="tns:ArrayOfReturnAlarm_Item"/>
            </sequence>
        </complexContent>
      </complexType>
      <complexType name="ArrayOfReturnAlarm_Item">
        <complexContent>
          <restriction base="soap11-enc:Array">
            <attribute ref="soap11-enc:arrayType"
wsdl:arrayType="tns:ReturnAlarm_Item[]"/></restriction></complexContent></complexType>
      <complexType name="ReturnAlarm_Item">
        <sequence>
          <element name="id" type="int"/>
          <element name="str"
type="string"/></sequence></complexType>

 <message name="YourEndpoint_your_Method">
    <part name="param1" type="xsd:int"/>
  </message>
  <message name="YourEndpoint_your_MethodResponse">
    <part name="result" type="ns2:ReturnAlarm"/>
  </message>

  etc. The most important part is the definition of
the return type.

My wscompile from the commandline:

wscompile.sh -import -mapping
resources/CallCentreWeb_Mapping.xml
resources/config-wsdl.xml

config-wsdl.xml:

<configuration
xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <wsdl
location="resources/CallCentreWebService.wsdl"
packageName="com.hostedtelecom.callcentreweb.endpoint">
    </wsdl>
</configuration>

Tricky, I know. Been there ;-) .

HTH,
iksrazal
http://www.braziloutsource.com/


--- Mariano Garcia <mgarcia_at_entel.es> wrote:

> Could you tell what parameters you use in wscompile,
> pls?
>
> I have attached my WSDL file, and I only get four
> classes when I use
> wscompile (as a ant task):
> * GetAlarms
> * SCIBWebService_Impl (service endpoint
> implementation)
> * SCIBWebService (service endpoint interface)
> * SCIBWebserviceService
>
> I suppose wscompile should generate Alarm.class and
> ArrayOfAlams.class... or maybe i am wrong??
>
> Webservices are going to kill me ^_^
>
> WSDL FILE:
> --------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions
> name="scibWebservice"
> targetNamespace="urn:SCIB-Webservices"
> xmlns:apachesoap="http://xml.apache.org/xml-soap"
>
>
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:impl="urn:SCIB-Webservices"
> xmlns:intf="urn:SCIB-Webservices"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>
>
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <wsdl:types>
> <schema elementFormDefault="qualified"
> targetNamespace="urn:SCIB-Webservices"
> xmlns="http://www.w3.org/2001/XMLSchema">
>
> <!-- ************** VALUE TYPES
> *************************** -->
>
> <complexType name="Alarm">
> <sequence>
> <element name="id" type="xsd:int"/>
> <element name="str" type="xsd:string"/>
> </sequence>
> </complexType>
>
> <element name="ArrayOfAlarms">
> <complexType base="SOAP-ENC:Array">
> <element name="alarm" element="impl:Alarm"
> maxOccurs="unbounded"/>
> </complexType>
> <anyAttribute/>
> </element>
>
> <!-- ************** getAlarms TYPES
> *************************** -->
> <element name="getAlarms">
> <complexType>
> <sequence>
> <element name="fromDate" type="xsd:dateTime"/>
> <element name="toDate" type="xsd:dateTime"/>
> </sequence>
> </complexType>
> </element>
>
> <element name="getAlarmsResponse">
> <complexType>
> <sequence>
> <element name="getAlarmsReturn"
> type="impl:ArrayOfAlarms"/>
> </sequence>
> </complexType>
> </element>
>
> </schema>
> </wsdl:types>
>
>
>
>
> <!-- ************** getAlarms MESSAGES
> ***************************
> -->
> <wsdl:message name="getAlarmsRequest">
>
> <wsdl:part element="impl:getAlarms"
> name="dates"/>
>
> </wsdl:message>
>
> <wsdl:message name="getAlarmsResponse">
>
> <wsdl:part element="impl:ArrayOfAlarms"
> name="alarmList"/>
>
> </wsdl:message>
>
>
>
>
> <wsdl:portType name="SCIBWebService">
>
> <!--
> OPERATION: getAlarms
> DESCRIPTION: This operation is used to get
> all the available
> alarms in period
> of time.
> INPUT: getAlarmsRequest message
> OUTPUT: getAlarmsResponse message
> -->
> <wsdl:operation name="getAlarms">
>
> <wsdl:input message="impl:getAlarmsRequest"
> name="getAlarmsRequest"/>
>
> <wsdl:output
> message="impl:getAlarmsResponse"
> name="getAlarmsResponse"/>
>
> </wsdl:operation>
> </wsdl:portType>
>
> <wsdl:binding name="SCIB-WebservicesSoapBinding"
> type="impl:SCIBWebService">
>
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="getAlarms">
>
> <wsdlsoap:operation soapAction=""/>
>
> <wsdl:input name="getAlarmsRequest">
>
> <wsdlsoap:body use="literal"/>
>
> </wsdl:input>
>
> <wsdl:output name="getAlarmsResponse">
>
> <wsdlsoap:body use="literal"/>
>
> </wsdl:output>
>
> </wsdl:operation>
>
>
> </wsdl:binding>
>
> <wsdl:service name="SCIBWebServiceService">
>
> <wsdl:port
> binding="impl:SCIB-WebservicesSoapBinding"
> name="SCIB-Webservices">
>
> <wsdlsoap:address
>
location="http://localhost:8080/SCIB-Webservices/scibWebservice"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail:
> users-help_at_jax-rpc.dev.java.net
>
>


"None are more hopelessly enslaved than those who falsely believe they are free. -- Goethe"


        
                
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/