You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Vikas Phonsa <VP...@suz.com> on 2004/07/21 01:03:44 UTC
Arrays in Document Style WebServices
Hi Everybody,
I'm trying to convert my rpc based web service to document style using axis
1.1 and am having some issues with the wsdl generated by java2wsdl. I need
to get a Contact in my SOAP message which could have an array of addresses.
When I use rpc I get following in my wsdl ( which shows that complexType
Contact has an array of addresses):
<complexType name="Contact">
<sequence>
<element name="arrayOfContactAddress" nillable="true"
type="impl:ArrayOfContactAddress"/>
</sequence>
</complexType>
<complexType name="ContactAddress">
<sequence>
<element name="personalCity" nillable="true" type="xsd:string"/>
<element name="personalAddressName" nillable="true" type="xsd:string"/>
<element name="personalCountry" nillable="true" type="xsd:string"/>
<element name="personalStreetAddress" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ArraryOfContactAddress">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="impl:ContactAddress[]"/>
</restriction>
</complexContent>
</complexType>
But when I use "document-literal" style, things get weird in the wsdl
generated from the very same java bean and I get this:
<complexType name="Contact">
<sequence>
<element maxOccurs="unbounded" name="arrayOfContactAddress"
nillable="true" type="impl:ContactAddress"/>
</sequence>
<complexType>
<complexType name="ContactAddress">
<sequence>
<element name="personalCity" nillable="true" type="xsd:string"/>
<element name="personalAddressName" nillable="true" type="xsd:string"/>
<element name="personalCountry" nillable="true" type="xsd:string"/>
<element name="personalStreetAddress" nillable="true"
type="xsd:string"/>
</sequence>
<complexType>
In this case the child element "arrayOfContactAddress" of Contact is no
more of type array and so in the SOAP
Message element named arrayOfContactAddress is repeated over and over again,
instead of an array which has elements of type
ContactAddress
And I need an array of address in a Contact.
How could this be taken care of in my document style web service.
And I may not be able to upgrade to axis 1.2
Thanks in advance.
Vikas
Re: Arrays in Document Style WebServices
Posted by Jean-Francois Denise - Sun Microsystems <je...@sun.com>.
Hello,
I am porting to WRAPPED/LITERAL and I observed the same thing.
Looking at the code, I noticed that if the param/return type is
class.isArray, the componentType only is set as the ParameterDesc type.
Is it what literal is about? If I understand well, it means that the
Array doesn't exits in literal.
Vikas Phonsa wrote:
> Hi Everybody,
>
>
>
> I'm trying to convert my rpc based web service to document style using
> axis 1.1 and am having some issues with the wsdl generated by
> java2wsdl. I need to get a Contact in my SOAP message which could have
> an array of addresses. When I use rpc I get following in my wsdl (
> which shows that complexType Contact has an array of addresses):
>
>
>
> <complexType name="Contact">
>
> <sequence>
>
> <element name="arrayOfContactAddress" nillable="true"
> type="impl:ArrayOfContactAddress"/>
>
> </sequence>
>
> </complexType>
>
>
>
> <complexType name="ContactAddress">
>
> <sequence>
>
> <element name="personalCity" nillable="true" type="xsd:string"/>
>
> <element name="personalAddressName" nillable="true"
> type="xsd:string"/>
>
> <element name="personalCountry" nillable="true" type="xsd:string"/>
>
> <element name="personalStreetAddress" nillable="true"
> type="xsd:string"/>
>
> </sequence>
>
> </complexType>
>
> <complexType name="ArraryOfContactAddress">
>
> <complexContent>
>
> <restriction base="soapenc:Array">
>
> <attribute ref="soapenc:arrayType"
> wsdl:arrayType="impl:ContactAddress[]"/>
>
> </restriction>
>
> </complexContent>
>
> </complexType>
>
>
>
>
>
> But when I use "document-literal" style, things get weird in the wsdl
> generated from the very same java bean and I get this:
>
>
>
>
>
> <complexType name="Contact">
>
> <sequence>
>
> <element maxOccurs="unbounded" name="arrayOfContactAddress"
> nillable="true" type="impl:ContactAddress"/>
>
> </sequence>
>
> <complexType>
>
> <complexType name="ContactAddress">
>
> <sequence>
>
> <element name="personalCity" nillable="true" type="xsd:string"/>
>
> <element name="personalAddressName" nillable="true"
> type="xsd:string"/>
>
> <element name="personalCountry" nillable="true" type="xsd:string"/>
>
> <element name="personalStreetAddress" nillable="true"
> type="xsd:string"/>
>
>
>
> </sequence>
>
> <complexType>
>
>
>
> In this case the child element "arrayOfContactAddress" of Contact is
> no more of type array and so in the SOAP
>
> Message element named arrayOfContactAddress is repeated over and over
> again, instead of an array which has elements of type
>
> ContactAddress
>
>
>
> And I need an array of address in a Contact.
>
>
>
> How could this be taken care of in my document style web service.
>
>
>
> And I may not be able to upgrade to axis 1.2
>
>
>
> Thanks in advance.
>
>
>
> Vikas
>
>
>
>
>
>
>
--
----------------------------------------------------------------------
Jean-Francois Denise Sun Microsystems
Sun ONE/Java Web Services
email: jfd@sun.com
Internal home page : http://icncweb.france/~jfdenise
-------------------------------------------------------------------