Re: Reusing unwrapped array elements in WSDL

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Thu, 12 May 2005 09:06:30 -0700

Just don't use an anonymous type. Instead refer to the same named type.

<element name=”getItemsResponse” type="ResponseType"/>

<element name ="getOperationTwoResponse" type="ResponseType"/>

<complexType name="ResponseType">


<element name=”item” type=”types:Item” minOccurs=”0” maxOccurs=”unbounded”/>



Ryan LeCompte wrote:

> Hello all,
> If there are multiple operations in a WSDL that return the same type
> of array, and we define the return element using the unwrapped array
> convention as follows:
> <element name=”getItemsResponse”>
> <complexType>
> <sequence>
> <element name=”item” type=”types:Item” minOccurs=”0”
> maxOccurs=”unbounded”/>
> </sequence>
> </complexType>
> </element>
> Do we need to repeat the above element declaration for each operation?
> So there would be an <element name=”getOperationOneResponse”> and
> <element name=”getOperationTwoResponse”> etc. Or is it possible to
> just reuse the same element declaration for each <message> part
> attribute? I tried reusing the element as such, and it appears that
> the code generated from the WSDL by wscompile wasn’t correct (it was
> using wrapped types as opposed to Item[]). I’m currently defining
> separate elements for each return type, and the generated code looks
> fine. However I’m noticing that wscompile is generating objects
> called, for example, “GetOperationOneResponse” and
> “GetOperationTwoResponse”, which essentially look identical as they
> both contain a single Item[] attribute. Is there anything that I can
> do at the WSDL-level to avoid duplication of such objects?
> Thanks,
> Ryan