You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/01/17 16:16:17 UTC

svn commit: r369813 - in /webservices/axis/trunk/c: src/soap/SoapDeSerializer.cpp tests/auto_build/testcases/output/SimpleXSDAny.cpp.out tests/auto_build/testcases/tests/SimpleXSDAny.xml tests/auto_build/testcases/unitTest.list

Author: dicka
Date: Tue Jan 17 07:16:09 2006
New Revision: 369813

URL: http://svn.apache.org/viewcvs?rev=369813&view=rev
Log:
AXISCPP-880

Resolve deserialization problems with xsd:any.
Also correcting expected response SimpleXSDAny, and adding to Unit Tests.

Modified:
    webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/SimpleXSDAny.cpp.out
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/SimpleXSDAny.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list

Modified: webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp?rev=369813&r1=369812&r2=369813&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp Tue Jan 17 07:16:09 2006
@@ -2433,6 +2433,7 @@
 
     int tagCount = 0;
     int lstSize = 0;
+    bool bContinue = false;
 
     AxisString xmlStr = "";
     AxisString nsDecls = "";
@@ -2444,13 +2445,30 @@
     	m_pNode = m_pParser->anyNext();
 	}
 
-	if( END_ELEMENT != m_pNode->m_type)
-	{
-		tagCount++;
-	}
-
-    while ((END_ELEMENT != m_pNode->m_type) || (tagCount >= 0))
+    while ((END_ELEMENT != m_pNode->m_type) || (tagCount >= 0) || bContinue)
     {
+        // Continue if processing start prefix,
+        // as we haven't yet found the true start of the tag
+        if (START_PREFIX == m_pNode->m_type)
+        {
+            bContinue = true;
+        }
+        else
+        {
+            bContinue = false;
+        }
+        
+        // Increment counter if entering new tag
+        if (START_ELEMENT == m_pNode->m_type && START_END_ELEMENT != m_pNode->m_type2)
+        {
+            tagCount++;
+        }
+        // Decrement counter if exiting tag
+        else if (END_ELEMENT == m_pNode->m_type)
+        {
+            tagCount--;
+        }
+        
     	if (START_PREFIX == m_pNode->m_type)
     	{
     	    nsDecls += " xmlns";
@@ -2479,10 +2497,12 @@
     	    xmlStr += m_pNode->m_pchNameOrValue;
     	}
     
-    	if (tagCount == 0 && (!xmlStr.empty ()))	/* copying the First level element into the list */
+    	if ( !bContinue && tagCount == 0 && (!xmlStr.empty ()))	/* copying the First level element into the list */
     	{
     	    lstXML.push_back (xmlStr);
     	    xmlStr = "";
+            m_pNode = NULL;
+            break;
     	}
     
     	m_pNode = m_pParser->anyNext ();
@@ -2496,15 +2516,6 @@
                 }
                 break;
             }
-    
-    	if (END_ELEMENT == m_pNode->m_type)
-    	{
-    	    tagCount--;
-    	}
-    	else if (START_ELEMENT == m_pNode->m_type && START_END_ELEMENT != m_pNode->m_type2)
-    	{
-    	    tagCount++;
-    	}
     }
 
     lstSize = lstXML.size ();
@@ -2560,8 +2571,10 @@
     
     	xmlStr += node->m_pchNameOrValue;
 
-    	if (!nsDecls.empty ())
-	       xmlStr += nsDecls.c_str ();
+        if (!nsDecls.empty ())
+        {
+            xmlStr += nsDecls.c_str ();
+        }
 
     	if (node->m_pchAttributes)
     	{
@@ -2579,10 +2592,10 @@
         		    {
             			pchPrefix = m_pParser->getPrefix4NS (node->
     						     m_pchAttributes[j + 1]);
-        		    }
-    	   	       else
-    		       {
-        	           pchPrefix = NULL;
+                    }
+                    else
+                    {
+                        pchPrefix = NULL;
                     }
         		    /* why dont parser return null if there is no
         		     * prefix. Expat does but not xerces.
@@ -2595,31 +2608,31 @@
         			    xmlStr += pchPrefix;
             			xmlStr += ":";
         		    }
-                   else
-                   {
-                      // if there is no prefix then we need to add a space
-                      xmlStr +=" ";
-                   }
+                    else
+                    {
+                        // if there is no prefix then we need to add a space
+                        xmlStr +=" ";
+                    }
         		    xmlStr += node->m_pchAttributes[j];
         		    xmlStr += "=\"";
         		    xmlStr += node->m_pchAttributes[j + 2];
         		    xmlStr += "\"";
-           		}
+                }
         	   	else
                 {
         		    break;
                 }
-        	 }
-	       }
+            }
+        }
 
-    if (START_END_ELEMENT == node->m_type2)
-	{
-    	xmlStr += "/>";
-	}
-	else
-	{
-    	xmlStr += ">";
-	}
+        if (START_END_ELEMENT == node->m_type2)
+        {
+            xmlStr += "/>";
+        }
+        else
+        {
+            xmlStr += ">";
+        }
     }
     else if (END_ELEMENT == node->m_type)
     {
@@ -2644,15 +2657,15 @@
     	    }
     	}
 
-	xmlStr += node->m_pchNameOrValue;
-    if (START_END_ELEMENT == node->m_type2)
-	{
-    	xmlStr += "/>";
-	}
-	else
-	{
-    	xmlStr += ">";
-	}
+        xmlStr += node->m_pchNameOrValue;
+        if (START_END_ELEMENT == node->m_type2)
+        {
+            xmlStr += "/>";
+        }
+        else
+        {
+            xmlStr += ">";
+        }
     }
 }
 

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/SimpleXSDAny.cpp.out
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/SimpleXSDAny.cpp.out?rev=369813&r1=369812&r2=369813&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/SimpleXSDAny.cpp.out (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/SimpleXSDAny.cpp.out Tue Jan 17 07:16:09 2006
@@ -1,4 +1,4 @@
-Result field1 is = <mybook>WSCC</mybook>
+Result field1 is = <mybook xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xsd_byte.test.apache.org">WSCC</mybook>
 Result field2 is = WebServices
 Result field3 is = 123
----------------------- TEST COMPLETE -----------------------------
\ No newline at end of file
+---------------------- TEST COMPLETE -----------------------------

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/tests/SimpleXSDAny.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/SimpleXSDAny.xml?rev=369813&r1=369812&r2=369813&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/SimpleXSDAny.xml (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/SimpleXSDAny.xml Tue Jan 17 07:16:09 2006
@@ -11,6 +11,9 @@
 		<request>
 			SimpleXSDAny.request
 		</request>
+		<serverResponse>
+			SimpleXSDAny_ServerResponse.expected
+	    </serverResponse>
     </expected>
 	<endpoint>-e http://localhost:9080/SimpleXSDAny/services/Service</endpoint>
 </test>

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list?rev=369813&r1=369812&r2=369813&view=diff
==============================================================================
Binary files - no diff available.