"rveerd" <[email protected]> writes:

> I am creating a client for a web service which uses the following WSDL 
> fragment.
>
> <complexType name="findAddress">
> <sequence>
> <element name="Address_1" type="ns2:Address" nillable="true"/>
> <element name="ArrayOfSearchOptionBase_2" type="ns2:ArrayOfSearchOptionBase" 
> nillable="true"/>
> <element name="ArrayOfSortOption_3" type="ns2:ArrayOfSortOption" 
> nillable="true"/>
> <element name="ArrayOfResultField_4" type="ns2:ArrayOfResultField" 
> nillable="true"/>
> <element name="CallerContext_5" type="ns3:CallerContext" nillable="true"/>
> </sequence>
> </complexType>
>
> If I create a findAddress struct and create only the Address_1 member gSOAP 
> serializes the struct to XML with only the Address_1 element. The server 
> rejects this XML as the
> other required elements (e.g. ArrayOfSearchOptionBase_2, etc.) are not 
> present.
>
> To get a correct message, I have to create the other members as well, 
> although they do not contain any useful data (i.e. they will be empty 
> elements in the XML). To me this
> seems a bit cumbersome.

Why not add 'minOccurs="0" maxOccurs="1"' attributes to the 'optional'
elements. The default for both of these is "1" which means that the
element is mandatory.

Reply via email to