OK for the sentence !
Now, as i said before, if i remove the indexed property setter/getter (or in
the original javabean, or hand-coding the wsdl), and just let the whole
array getter/setter, the wsdl properly describes the sequence of complex
type, and the serialization/deserialization seems to work.
With this complex type, describing an 'order' with a string and an array of
products :
<complexType name="ArrayOfProduct">
<sequence>
<element name="item" type="impl:Product" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</complexType>
...
<complexType name="Order">
<sequence>
<element name="products" nillable="true" type="impl:ArrayOfProduct"/>
<element name="string" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
The wsdl2java for the client produces a class with the same getter/setter
that has my original javabean :
public my.service3.CompositeBean[] getCompositeBeans() {
return compositeBeans;
}
public void setCompositeBeans(my.service3.CompositeBean[]
compositeBeans) {
this.compositeBeans = compositeBeans;
}
And, on the server side, my javabean setter/getter are properly used too by
the serializer/deserializer.
So, it works !
But, is this the best or unique way to represent the 1-n associations ?
Thanks again for your comments.
>>> -----Original Message-----
>>> From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
>>> Sent: Wednesday, June 15, 2005 5:41 PM
>>> To: [email protected]
>>> Subject: Re: Complex type / Javabean design
>>>
>>>
>>> hehehe...WSDL First! :)
>>>
>>> -- dims
>>>
>>> On 6/15/05, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>>> > Hello.
>>> >
>>> > This is a simple, perhaps stupid, question about how to
>>> design some kind of
>>> > javabeans to be good complex types for the wsdl and soap translation.
>>> >
>>> > I have done some basic tests with simple flat, structure like
>>> javabeans with
>>> > primitive or 1-1 aggregated complex types. All this seems to
>>> work with Axis.
>>> >
>>> > Now, i'm looking for more complex types with 1-n agregations.
>>> For instance
>>> > an "Order" and "Product line". The javabean convention let
>>> the bean designer
>>> > provide both agregate getter and setter, and indexed
>>> properties ones. In my
>>> > previous example, operations on my Order object could be
>>> something like :
>>> >
>>> > ProductLine[] getProductLines()
>>> > void setProductLines(ProductLine[] pl)
>>> >
>>> > to set or get the whole agregate. But indexed properties
>>> style methods could
>>> > also be :
>>> >
>>> > ProductLine getProductLine(int index)
>>> > void setProductLine(ProductLine pl, int index)
>>> >
>>> > I've tested something like that with axis (1.2 final), and
>>> the java2wsdl
>>> > produces a strange result. The Order type references two
>>> pseudo-attributes :
>>> > one for the array, mapping the first setter/getter set, and
>>> another one for
>>> > the indexed property...
>>> >
>>> > In this case, or similar cases, does it make sense to design
>>> (or reuse) such
>>> > javabeans. If yes, is there any way to use the standard java2wsdl
>>> > translation (I know someone is going to quickly answer to
>>> wsdl it first !),
>>> > and standard serializers ?
>>> >
>>> > Thanks for your comments.
>>> >
>>> > --
>>> > Ephemeris Lappis
>>> >
>>> >
>>>
>>>
>>> --
>>> Davanum Srinivas -http://blogs.cocoondev.org/dims/