axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Exton (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-991) Deserializing complex type broken when start-end element tag is encountered
Date Thu, 19 Oct 2006 08:38:38 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-991?page=comments#action_12443453 ] 
            
Scott Exton commented on AXISCPP-991:
-------------------------------------

I am not sure if you have a solution to this problem yet, but I also encountered the same
problem today.  I have managed to 'hack' a solution that works.  

The problem comes down to the fact that if an item is correctly de-serialized an assumption
is made that the next node is the terminator for the item (i.e. </item>).  In our case
the de-serialization was working correctly (it de-serialized an empty node), but the next
node was not the terminator node, instead it was our next element.  So, instead of skipping
the terminator we skipped the next element.

So, to overcome the problem you need to add a check prior to the m_pParser->next() call
to determine if the next element is a 'terminator' or not.  You should then only move to the
next node if the next node is a 'terminator'.  We determine whether the next node is a terminator
by peeking at the next node.  If an empty string is returned we know that the next node is
a terminator.  This is not the most elegent solution but works for the time being.

Anyway, here is a code snippet for a new function within SoapDeSerializer.cpp.  You need to
change the lines within SoapDeSerializer.cpp which look like the following "m_pParser->next
();    /* skip end node too */" with a call to the new skipEndNode function.

void SoapDeSerializer::skipEndNode()
{
    /*
     * According to the XMLParserXerces.cpp file (specifically the ::peek
     * method), an empty string will be returned if the next element is
     * a closing (or end) element.  So, if the peek function does not return
     * an empty string we do not want to advance to the next element.
     */

    const char* nextName = m_pParser->peek();

    if (nextName[0] == 0x00) {
	m_pParser->next ();	/* skip end node too */
    }
}

Hope that this helps.  Someone really needs to code up the optimal solution for this problem
and add it back into the project.  My lack of knowledge about the rest of Axis prevents me
from being confident about doing this myself.


> Deserializing complex type broken when start-end element tag is encountered
> ---------------------------------------------------------------------------
>
>                 Key: AXISCPP-991
>                 URL: http://issues.apache.org/jira/browse/AXISCPP-991
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Client - Deserialization
>            Reporter: nadir amra
>         Assigned To: nadir amra
>
> If a complex type defined as:
>       <s:complexType name="SortR">
>         <s:sequence>
>           <s:element minOccurs="0" maxOccurs="1" name="ListMsg" type="tns:ArrayOfMsgS"
/>
>           <s:element minOccurs="0" maxOccurs="1" name="DateMed" type="s:string" />
>           <s:element minOccurs="1" maxOccurs="1" name="NumberMed" type="s:int" />
>         </s:sequence>
>       </s:complexType>
> And the response comes back as:
> <SortRResult>
>     <ListMsg/>
>     <DateMed>2006-11-10</DateMed>
>     <NumberMed>123456</NumberMed>
> .
> .
> The deserialization of ListMsg does not recognize the fact that empty element was passed
and thus attempts to parse the subsequent data as if it was part of ListMsg. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message