You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Ju...@fr.thalesgroup.com on 2004/11/16 08:58:01 UTC

[AXIS C++ 1.3] Bug in SoapDeSerializer::getBasicArray when there is more than one array

Hello,
	I created a small webservice application with multiple arrays, here
is the fragment of the wsdl file :

      <xsd:complexType name="TestMsg">
        <xsd:sequence>
          <xsd:element type="xsd:int" minOccurs="1"
	               maxOccurs="unbounded" name="docs"/>
          <xsd:element type="xsd:string" minOccurs="1"
	               maxOccurs="unbounded" name="tags"/>
	</xsd:sequence>
      </xsd:complexType>

and here is a sample of the client query :
<TestMsg xsi:type="ns2:TestMsg"
         xmlns:ns2="http://localhost:4242/axis/Test/xsd">
  <docsArray xmlns:enc="http://www.w3.org/2001/06/soap-encoding" 
             enc:arrayType="xsd:int[5]">
    <item>15</item>
    <item>20</item>
    <item>25</item>
    <item>32</item>
    <item>39</item>
  </docsArray>
  <tagsArray xmlns:enc="http://www.w3.org/2001/06/soap-encoding" 
             ncc:arrayType="xsd:string[3]">
    <item>NomCommun</item>
    <item>NomPropre</item>
    <item>Verbe</item>
  </tagsArray>
</TestMsg>

Using axis-c 1.3, I could not get these two vectors, I could get only
one of them.
After some investigation, I found that
SoapDeSerializer::getBasicArray() always get the first next node and after
some
debug, I discovered that the next node was </docsArray> which failed in all
cases.

In order to get the next node not null, I patch the method :
--- axis-c-src-1-3-linux/src/soap/SoapDeSerializer.cpp	2004-10-22
14:50:49.000000000 +0200
+++ axis-c-src-1-3-linux.modif/src/soap/SoapDeSerializer.cpp	2004-11-15
13:59:12.000000000 +0100
@@ -726,10 +726,11 @@
     free(Array.m_Array);\
     Array.m_Array = 0;\
     Array.m_Size = 0;\
     return Array;\
 }\
+m_pNode = m_pParser->next(); /* skip end element node */\
 return Array;
 
 #define DESERIALIZE_LITERAL_ARRAY_BLOCK(cpp_type, conv_func) \
             Array.m_Array = malloc(sizeof(cpp_type)*INITIAL_ARRAY_SIZE);\
             if (!Array.m_Array) return Array;\
@@ -848,10 +849,11 @@
                     free(Array.m_Array);
                     Array.m_Array = 0;
                     Array.m_Size = 0;
                     return Array;
                 }
+                m_pNode = m_pParser->next(); /* skip end element node */
                 return Array;
             case XSD_UNSIGNEDINT:
                 DESERIALIZE_ENCODED_ARRAY_BLOCK(unsigned int, CONV_STRTOUL)
             case XSD_SHORT:
                 DESERIALIZE_ENCODED_ARRAY_BLOCK(short, CONV_STRTOL)

I am not familiar with axis code, so I am not sure that this is the
best way to fix this problem. If necessary, I can fill a bug report using
JIRA.

Best Regards.
-- 
Julien Lemoine