Return an array of objects

From: Mariano García <>
Date: Tue, 06 Sep 2005 09:54:26 +0200

Hi all,

I posted this mail in jwsdp mailing list, but maube this should be the
correct one.

I am developing a webservice in my company, and I need some help with
some aspects (i am a little newbie with jwsdp).

I am using jax-rpc in order to develop my webservice, wrinting first the
WSDL file, and then generating the java file using wscompile.

I want to write a service that returns a list of objects. These objects
follow the javaBean convention (attributtes with set/get methods).

This is the WSDL code I have used:

<!-- ************** TYPES *************************** -->
<complexType name="ArrayOfmyObject">
    <restriction base="soap-enc:Array">
      <attribute ref="soap-enc:arrayType"

<!-- All the attributes are basic types, as int, string and dates -->
<element name="myObject">
      <element name="att1" type="xsd:int"/>

<element name="getObjects">
      <element name="fromDate" type="xsd:dateTime"/>
      <element name="toDate" type="xsd:dateTime"/>

<element name="getObjectsResponse">
      <element name="getmyObjectsReturn" type="impl:ArrayOfmyObject"/>

<!-- ************** MESSAGES *************************** -->
   <wsdl:message name="getObjectsRequest">

      <wsdl:part element="impl:getObjects" name="dates"/>

   <wsdl:message name="getObjectsResponse">

      <wsdl:part element="impl:getObjectsResponse" name="objectList"/>


I don't know if this service defined ok, because I don't find enough info about how to return arrays of objects.

Wscompile has generated my implementation class in this way:

public javax.xml.soap.SOAPElement getObjects(java.util.Calendar
fromDate, java.util.Calendar toDate) throws
         java.rmi.RemoteException {
        return null;

In this method I will use all the stuff in order to get all my objects
from a database. So, I need to convert a java List object a SOAPElement object.
Is this possible? I don't know how to do it.

It is sure that these questions are very easy for you, but I am very