Excellent then, starting from scratch is so much easier ;-) . 

I'll briefly show you how to use a complex type with and without 
java.util.List. (Use List instead of Vector here). Using List, the idea here 
is that we want to convert the List of complex objects to array. 

This example uses 'extension base' - all the complex types extend it for error 
handling. It may help you but it also makes things slightly more difficult to 
understand. 

The below uses java 5.0 and axis 1.3 . As stated, it uses rpc encoded arrays - 
not yet supported in axis2. You should be fine if you have control of the 
client and server, using axis 1.3, 1.4 etc or even JWSDP from sun.  

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="CallCentreWebService" 
targetNamespace="http://com/callcentreweb"; 
xmlns:tns="http://com/callcentreweb"; xmlns="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:ns2="http://com/callcentreweb/types";>
  <types>
    <schema targetNamespace="http://com/callcentreweb/types"; 
xmlns:tns="http://com/callcentreweb/types"; 
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="ReturnWeb_Base">
        <sequence>
          <element name="errorMessage" type="string"/>
          <element name="successErrorCode" 
type="int"/></sequence></complexType>
      <complexType name="ReturnWeb_Login">
        <complexContent>
          <extension base="tns:ReturnWeb_Base">
            <sequence>
              <element name="SOAP_Session_id" type="string"/>
              <element name="web_user_name" 
type="string"/></sequence></extension></complexContent></complexType>
      <complexType name="ReturnWeb_AdminResellerListNewsCentres">
        <complexContent>
          <extension base="tns:ReturnWeb_Base">
            <sequence>
              <element name="list" 
type="tns:ArrayOfReturnWeb_AdminResellerListNewsCentres_Item"/></sequence></extension></complexContent></complexType>
      <complexType name="ArrayOfReturnWeb_AdminResellerListNewsCentres_Item">
        <complexContent>
          <restriction base="soap11-enc:Array">
            <attribute ref="soap11-enc:arrayType" 
wsdl:arrayType="tns:ReturnWeb_AdminResellerListNewsCentres_Item[]"/></restriction></complexContent></complexType>
      <complexType name="ReturnWeb_AdminResellerListNewsCentres_Item">
        <sequence>
          <element name="news_id" type="int"/>
          <element name="call_centre_id" type="int"/>
          <element name="call_centre_name" 
type="string"/></sequence></complexType>
</schema></types>
  <message name="CallCentreWebEndpoint_web_Login">
    <part name="user_name" type="xsd:string"/>
    <part name="user_password" type="xsd:string"/>
  </message>
  <message name="CallCentreWebEndpoint_web_LoginResponse">
    <part name="result" type="ns2:ReturnWeb_Login"/>
  </message>
  <message name="CallCentreWebEndpoint_web_adminreseller_ListNewsCentres">
    <part name="soap_session_id" type="xsd:string"/>
  </message>
  <message 
name="CallCentreWebEndpoint_web_adminreseller_ListNewsCentresResponse">
    <part name="result" type="ns2:ReturnWeb_AdminResellerListNewsCentres"/>
  </message>
  <portType name="CallCentreWebEndpoint">
    <operation name="web_Login" parameterOrder="user_name user_password">
      <input message="tns:CallCentreWebEndpoint_web_Login"/>
      <output message="tns:CallCentreWebEndpoint_web_LoginResponse"/>
    </operation>
    <operation name="web_adminreseller_ListNewsCentres" 
parameterOrder="soap_session_id">
      <input 
message="tns:CallCentreWebEndpoint_web_adminreseller_ListNewsCentres"/>
      <output 
message="tns:CallCentreWebEndpoint_web_adminreseller_ListNewsCentresResponse"/>
    </operation>
  </portType>
  <binding name="CallCentreWebEndpointBinding" 
type="tns:CallCentreWebEndpoint">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="rpc"/>
    <operation name="web_adminreseller_ListNewsCentres">
      <soap:operation soapAction=""/>
      <input>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
use="encoded" namespace="http://localhost/callcentreweb"/></input>
      <output>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
use="encoded" 
namespace="http://localhost/callcentreweb"/></output></operation>
    <operation name="web_Login">
      <soap:operation soapAction=""/>
      <input>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
use="encoded" namespace="http://com/callcentreweb"/></input>
      <output>
        <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
use="encoded" 
namespace="http://com/callcentreweb"/></output></operation></binding>
  <service name="CallCentreWebService">
    <port name="CallCentreWebEndpointPort" 
binding="tns:CallCentreWebEndpointBinding">
      <soap:address 
location="http://127.0.0.1"/></port></service></definitions>

Inside the generated CallCentreWebEndpoint.java , the non-array based complex 
type is instantiated like: 

return new ReturnWeb_Login ( Messages_Codes.get(successErrorCode), 
successErrorCode.intValue(), soap_session_id, web_user_name);

The array based one is trickier: 

ReturnWeb_AdminResellerListNewsCentres result = new 
ReturnWeb_AdminResellerListNewsCentres();
java.util.List list = new ArrayList();
// db result set - just an example
while (rs.next()) {

                          bRecordFound = true;

                          ReturnWeb_AdminResellerListNewsCentres_Item item = 
new ReturnWeb_AdminResellerListNewsCentres_Item(
                                  rs.getInt("news_id"),
                                  rs.getInt("call_centre_id"),
                                  rs.getString("call_centre_name")
                                  );

                          list.add(item);
                        }
 rs.close(); 
ReturnWeb_AdminResellerListNewsCentres_Item[] list_array  =  new 
ReturnWeb_AdminResellerListNewsCentres_Item[0];

list_array = (ReturnWeb_AdminResellerListNewsCentres_Item[]) 
list.toArray(list_array);
result.setList(list_array);

I'm afraid my example of a client isn't going to help you much - it uses 
Service instead of Call. Nevertheless...

 org.jboss.webservice.client.ServiceFactoryImpl factory= 
(org.jboss.webservice.client.ServiceFactoryImpl) 
ServiceFactoryImpl.newInstance();
            javax.xml.rpc.Service service = factory.createService(url, 
mappinglocation, ws4eeMetaData,  qname, null);
            endpoint = (CallCentreWebEndpoint) 
service.getPort(CallCentreWebEndpoint.class);

Once you get the endpoint - try using axis Call instead of Service -  it'll be 
like:

              ReturnWeb_AdminResellerListNewsCentres  rwl = 
endpoint.web_adminreseller_ListNewsCentres(sessionStr);
              System.out.println("Success code: " + 
rwl.getSuccessErrorCode());
              System.out.println("Success message: " + rwl.getErrorMessage());

              ReturnWeb_AdminResellerListNewsCentres_Item[] list = 
rwl.getList();
              System.out.println("list length: " + list.length);
              for (int xx = 0; xx < list.length; xx++) {

                ReturnWeb_AdminResellerListNewsCentres_Item item = list[xx];
                System.out.println("news_id: " + item.getNews_id());
                System.out.println("call_centre_id: " + 
item.getCall_centre_id());
                System.out.println("call_centre_name: " + 
item.getCall_centre_name());
             }

HTH, 
iksrazal

Em Terça 13 Dezembro 2005 14:51, o Helcio Wagner escreveu:
>       Hi, Iksrazaç.
>
> > Do you have control over the wsdl on the server side and are able to
> > prepare the array, or are you just a client?
>
>       I am building all stuff from scratch. In other words, I am building the
> Java source files, compiling them, building a descriptor file and
> deploying the service.
>
>       The wsdl file is obtained when I point to the Service using a Web
> browser...
>
>       I am building a Client for this Web Service as well.
>
>       Helcio.

Reply via email to