axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bennett, Robert P" <Robert.Benn...@ca.com>
Subject generated C code from choice elements in wsdl
Date Tue, 27 May 2008 21:32:06 GMT
I have a situation where I am passing a response message that can be one
of a set of different complex types.  I am using the 'choice' element to
indicate this, like the following.  When I run the attached wsdl through
the wsdl2c utility (from axis2 1.4), the adb C code that is generated
(the serialize and deserialize functions) assumes that both A and B
elements are present in the message and generates an error (or a null
pointer reference) if either is missing.  By the way, the flags I used
with wsdl2c are 
"-sd -ss -g -d adb -sp -wv 1 -u -f ".

Am I right to assume that the meaning of 'choice' is that one of the
list of elements is present, but not all of them?

Thank you, 
   Bob Bennett

            <xsd:element name="inputData">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="AorB" type="AorBChoice"
				minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>

	    <xsd:complexType name="AorBChoice">
		<xsd:sequence>
		  <xsd:choice>
		     <xsd:element name="A" type="AType"/>
		     <xsd:element name="B" type="BType"/>
		  </xsd:choice>
		</xsd:sequence>
	    </xsd:complexType>

	    <xsd:complexType name="AType">
		<xsd:sequence>
		     <xsd:element name="Afield1" type="xsd:string"/>
		     <xsd:element name="Afield2" type="xsd:string"/>
		</xsd:sequence>
	    </xsd:complexType>

	    <xsd:complexType name="BType">
		<xsd:sequence>
		     <xsd:element name="Bfield1" type="xsd:string"/>
		     <xsd:element name="Bfield2" type="xsd:string"/>
		</xsd:sequence>
	    </xsd:complexType> 
 

Mime
View raw message