axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cheng liang" <chengliang2...@hotmail.com>
Subject SoapDeSerializer bug
Date Sun, 09 May 2004 06:46:56 GMT
hi, all,

I think there are some bugs in SoapDeSerializer.

look at following xml from sever:
--------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSc 
hema-instance"> 
  <soapenv:Body> 
   <ns1:getUserResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/en 
coding/" 
xmlns:ns1="http://10.7.0.237:8080/SysPlatform/services/UserClass"> 
    <ns1:getUserReturn href="#id0"/> 
   </ns1:getUserResponse> 
   <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmls 
oap.org/soap/encoding/" xsi:type="ns2:UsersWS" 
xmlns:soapenc="http://schemas.xml 
soap.org/soap/encoding/" xmlns:ns2="urn:BeanService"> 
    <address xsi:type="xsd:string"></address> 
    <birthday xsi:type="xsd:date">1986-01-01</birthday> 
    <certificateCategory 
xsi:type="xsd:string">category</certificateCategory> 
    <certificateNumber xsi:type="xsd:string"></certificateNumber> 
    <collaboratorId xsi:type="xsd:int">0</collaboratorId> 
    <country xsi:type="xsd:string">cn</country> 
    <description xsi:type="xsd:string"></description> 
    <email xsi:type="xsd:string"></email> 
    <handset xsi:type="xsd:string"></handset> 
    <handsetBand xsi:type="xsd:string" xsi:nil="true"/> 
    <msn xsi:type="xsd:string"></msn> 
    <nickName xsi:type="xsd:string">test2</nickName> 
    <password xsi:type="xsd:string">111111</password> 
    <postalcode xsi:type="xsd:string"></postalcode> 
    <province xsi:type="xsd:string">31</province> 
    <qq xsi:type="xsd:string"></qq> 
    <question xsi:type="xsd:string">hello</question> 
    <realName xsi:type="xsd:string"></realName> 
    <registerIp xsi:type="xsd:string">10.7.0.10</registerIp> 
    <registerTime 
xsi:type="xsd:dateTime">2004-04-27T19:57:17.000Z</registerTime> 
 
    <result xsi:type="xsd:string"></result> 
    <secondPassword xsi:type="xsd:string" xsi:nil="true"/> 
    <sex xsi:type="xsd:string">0</sex> 
    <telephone xsi:type="xsd:string"></telephone> 
    <userId xsi:type="xsd:long">23</userId> 
    <userName xsi:type="xsd:string">test2</userName> 
    <website xsi:type="xsd:string"></website> 
   </multiRef> 
  </soapenv:Body> 
</soapenv:Envelope> 

----------------------------------------------------------------------

you will find between the start_element node and the end_element node
there may be nothing.

But for example in SoapDeSerializer::GetElementAsString(...) function, 
the code did not treat this situation.

I modify the code as follows:

----------------------------------------------------------------------

if (XSD_STRING == GetXSDType(m_pNode))
{
      m_pNode = m_pParser->Next(true); /* charactor node */
      if (m_pNode && (CHARACTER_ELEMENT == m_pNode->m_type))
      {
           ret = strdup(m_pNode->m_pchNameOrValue);
           /* this is because the string may not be available later */
           m_pNode = m_pParser->Next(); /* skip end element node too */
           return ret;
      }
      else if(m_pNode && (END_ELEMENT == m_pNode->m_type))
     {
	ret = "";
	return ret;
     }
}

------------------------------------------------------------------------

The same question may also lie in other functions.

best,
Cheng Liang

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  


Mime
View raw message