axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmostt...@bco.com
Subject RE: question regarding arrays of beans and doc/lit (wrapped)
Date Tue, 12 Oct 2004 15:12:33 GMT
I don't have an answer but I can tell you that the new class, ArrayOf_*, is
not necessary for proper functioning of your service or the client if it is
an Axis Java client.

But if you need to have the service be interop with other clients like .NET
then the service you described does not work.  Currently there is a bug
somewhere in Axis relating to arrays as a bean property, they do not
serialize correctly.  A work around I have found is to actually change my
bean to return the generated ArrayOf_* class (actually I only generated it 1
time then just use it).  The serialization is then correct and works with a
.NET client and the Axis Java client.

marcus

-----Original Message-----
From: Shantanu Sen [mailto:ssen@pacbell.net] 
Sent: Monday, October 11, 2004 8:29 PM
To: axis-user
Subject: question regarding arrays of beans and doc/lit (wrapped)


Sorry for sending the previous message too soon...

I have a question regarding the following scenario. 

I start of with a set of java classes. The main class
is listsvc.ListService:

public interface ListService extends java.rmi.Remote {

    public ListPropertyBean[] getListProperties(
                         String listId)
        throws RemoteException, BadIdException;
....
}

The ListProperyBean is defined as follows

public class ListPropertyBean implements Serializable
{

    private String name_;
    private String label_;
    private ReportBean[] reportBeans_;
...
}

The ReportBean is a simple bean:

public class ReportBean implements Serializable {

    private String name_;
    private String type_;
..
}

Now when I use rpc-encoded, I get this in the
generated wsdl for the ReportBean array:

<complexType name="ArrayOf_tns1_ReportBean">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:ReportBean[]"/>
     </restriction>
    </complexContent>
</complexType>

The corresponding typemapping in the wsdd is

<typeMapping
        xmlns:ns="listsvc"
        qname="ns:ArrayOf_tns1_ReportBean"
        type="java:listsvc.ReportBean[]"
...
>

The serializer in this case is ArraySerializerFactory 

When I use wrapped mode, the wsdl has this:

 <complexType name="ArrayOf_tns1_ReportBean">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0"
name="item" type="tns1:ReportBean"/>
    </sequence>
   </complexType>

And the corresponding wsdd has 

<typeMapping
        xmlns:ns="listsvc"
        qname="ns:ArrayOf_tns1_ReportBean"
        type="java:listsvc.ArrayOf_tns1_ReportBean"
...>

with the serializerFactory as the
BeanSerializerFactory.

The issue with this is that a new class is generated
for the wrapped mode: the ArrayOf_tns1_ReportBean
which has a getItem and setItem that uses the listsvc.ReportBean.

Since I have pre-existing java classes (e.g.
listsvc.ReportBean etc) this means that I have to
compile this new class ArrayOf_tns1_ReportBean if I
want to load the WSDD programmatically (since it walks
through the typemapping and instantiates each class). 

This is undesirable. Is there any way I can use
doc/lit but still ensure that the generated classes
(from the  wsdl2java) remain the same as the original
classes that was there when the java2wsdl was invoked? Essentially, I want
to use the wrapped mode, but do not want the arrays be mapped to any new
classes. Is there any 
switch that I can use with Java2WSDL to ensure this?

Thanks for any help.

Shantanu Sen

Mime
View raw message