axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catalina Caloian" <Catalina.Calo...@quintiq.com>
Subject Incorrect deserialization when the first child is an empty element
Date Wed, 12 Nov 2008 13:39:14 GMT
Hello.

Scenario: 
     - the first element in a sequence is nillable
     - in the actual XML, that first element is present, but is empty
     - the deserialization code of the parent mishandles this element by not recognizing it
as being its *first* child element and by treating it as if it were a child with position
>= 2

Example:

Relevant part of the wsdl:

<complexType name="TransientVO">
    <sequence></sequence>
  </complexType>

<complexType name="Address">
        <complexContent>
             <extension base="ns2:TransientVO">
              	   <sequence>  </sequence>     
                   <!-- attributes -->
             </extension>
        </complexContent>
    </complexType>      

<complexType name="ResultAddress">
        <complexContent>
            <extension base="tns:Address">
	<sequence>      
		<element name="wrappedAdditionalFields" type="tns:ArrayOfAdditionalField" minOccurs="1"
maxOccurs="1" nillable="true"/> 
		<element name="coordinates" type="ns1:Point" minOccurs="0" maxOccurs="1" nillable="true"/>

            	</sequence>     
                <!-- attributes --> 
            </extension>
        </complexContent>
 </complexType>



If 'wrappedAdditionalFields' would have been recognized as the first child element, according
to the CADBBeanTemplateSource.xsl template, the deserialization code would have looked something
like this:
adb_ResultAddress_deserialize(...)
{
   ...
   /*
    * building wrappedAdditionalFields element
    */

   current_node = first_node;
   is_early_node_valid = AXIS2_FALSE;
   ...
}

Instead, the deserialization code looks something like this:

adb_ResultAddress_deserialize(...)
{
   ...
   /*
    * building wrappedAdditionalFields element
    */

    /*
     * because elements are ordered this works fine
     */ 
       if(current_node != NULL && is_early_node_valid)
       {
         // code as if this were a child with position >= 2
         // at this point, current_node is NULL because no element has been recognized as
being the first child (and no element will be recognized as such)
       }
}


For generating C code I have used axis2-1.4.1-src with some slight changes to CADBBeanTemplateSource.xsl
to embed some minor bug fixes.

I have attached to this e-mail the wsdl and the template I've been using.

I'm not sure if this problem is a bug in Axis2C or in Axis2. However, I thought I would try
to raise this problem here hoping that somebody might be able to help me.

Thank you,
Catalina Caloian


     


This message contains information that may be privileged or confidential and is the property
of Quintiq. It is only intended for the person to whom it is addressed. If you are not the
intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute
or use this message or any part thereof. If you have received this message in error, please
notify the sender immediately and delete all copies of this message. Please note that e-mails
are susceptible to change, therefore they are not binding.

Mime
View raw message