axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r730027 - in /webservices/axis/trunk/c: src/common/Param.cpp src/engine/client/Call.cpp src/soap/SoapMethod.cpp src/soap/SoapSerializer.cpp tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected
Date Tue, 30 Dec 2008 01:32:53 GMT
Author: nadiramra
Date: Mon Dec 29 17:32:53 2008
New Revision: 730027

URL: http://svn.apache.org/viewvc?rev=730027&view=rev
Log:
AXISCPP-458 - unwrapped support. Fixes.

Modified:
    webservices/axis/trunk/c/src/common/Param.cpp
    webservices/axis/trunk/c/src/engine/client/Call.cpp
    webservices/axis/trunk/c/src/soap/SoapMethod.cpp
    webservices/axis/trunk/c/src/soap/SoapSerializer.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected

Modified: webservices/axis/trunk/c/src/common/Param.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/common/Param.cpp?rev=730027&r1=730026&r2=730027&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/Param.cpp (original)
+++ webservices/axis/trunk/c/src/common/Param.cpp Mon Dec 29 17:32:53 2008
@@ -185,12 +185,8 @@
             }
             else
             {
-                // In order to support doc/lit unwrapped, m_sName (qualified element name)
is passed as a null 
-                // string in the stub code.  So we do not want to serialize null string in
this case. 
-                //
                 // NOTE: ">" is not serialized to enable the type's serializer to add
attributes.
-                if (!m_sName.empty())
-                    pSZ.serialize ("<", m_sName.c_str (), NULL); 
+                pSZ.serialize ("<", m_sName.c_str (), NULL); 
 
                 logDebugArg2("Calling serializer function %p for complex object %p", m_Value.pCplxObj->pSZFunct,
m_Value.pCplxObj->pObject)
 
@@ -198,8 +194,7 @@
 
                 logDebugArg2("Returned from serializer function %p, status=%d", m_Value.pCplxObj->pSZFunct,
stat)
 
-                if (!m_sName.empty())
-                    pSZ.serialize ("</", m_sName.c_str (), ">\n", NULL);
+                pSZ.serialize ("</", m_sName.c_str (), ">\n", NULL);
             }
             break;
         case XSD_ANY:

Modified: webservices/axis/trunk/c/src/engine/client/Call.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/engine/client/Call.cpp?rev=730027&r1=730026&r2=730027&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/Call.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/Call.cpp Mon Dec 29 17:32:53 2008
@@ -165,20 +165,9 @@
 {
     logEntryEngine("Call::setOperation")
 
-    m_pIWSSZ->createSoapMethod (pchOperation, pchNamespace);
+    m_pIWSSZ->createSoapMethod (pchOperation, pchNamespace, bIsWrapperStyle);
     m_pAxisEngine->getMessageData()->setOperationName(pchOperation);
     
-    SoapMethod* sm = getSOAPSerializer()->getSOAPMethod();
-    sm->setWrapperStyle(bIsWrapperStyle); 
-    
-    if (!bIsWrapperStyle)
-    {
-        // TODO why can we not do this for wrapper-style also? For wrapper, we add namespace
-        //      definition to wrapper element, but why not to envelope? Investigate.
-        m_pIWSSZ->addNamespaceToEnvelope((AxisChar * )pchNamespace, 
-                                         (AxisChar * )m_pIWSSZ->getNamespacePrefix(pchNamespace));
-    }
-    
     logExit()
 }
 

Modified: webservices/axis/trunk/c/src/soap/SoapMethod.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/SoapMethod.cpp?rev=730027&r1=730026&r2=730027&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapMethod.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapMethod.cpp Mon Dec 29 17:32:53 2008
@@ -157,30 +157,33 @@
             }
             else
             {
-            	// We are doing non-wrapper style.  The call to Call::setOperation resulted
in 
-            	// initial namespace being added to the envelope.  So we do not have to define
-            	// initial namespace, although we need to define it to the serializer so that
-            	// subsequent namespaces are indexed correctly.
+            	// We are doing non-wrapper style.  
             	
             	if (!m_OutputParams.empty())
-            	{
+            	{	
             		// Serialize parameters....
-            		
-	                // push the current NS to the NS stack
-	                pSZ.getNamespacePrefix(m_strUri.c_str());
-	                
-	                iStatus= serializeOutputParam(pSZ);
 	                
-	                // remove the current NS from the NS stack
+	                // remove the current NS from the NS stack - we want the bean to define
the namespace.
+            		// We could have added initial namespace to envelope, but for complex types
+            		// it seemed best to declare namespace as part of root element of xml document.
 	                pSZ.removeNamespacePrefix(m_strUri.c_str());
 	                
+	                iStatus= serializeOutputParam(pSZ);
+	                	                
 	                if(iStatus==AXIS_FAIL)
 	                    break;
             	}
             	else if (!m_strLocalname.empty())
             	{
+                    // push the current NS to the NS stack
+            		const char *nsToUse=pSZ.getNamespacePrefix(m_strUri.c_str());
+            		
             		// Serialize an empty element request.
-                    pSZ.serialize("<", m_strPrefix.c_str(), ":", m_strLocalname.c_str(),
"/>", NULL);
+                    pSZ.serialize("<", nsToUse, ":", m_strLocalname.c_str(),
+                         " xmlns:", nsToUse, "=\"", m_strUri.c_str(), "\" />", NULL);
   
+                    
+                    // remove the current NS from the NS stack
+                    pSZ.removeNamespacePrefix(m_strUri.c_str());
             	}
             }
         }

Modified: webservices/axis/trunk/c/src/soap/SoapSerializer.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/SoapSerializer.cpp?rev=730027&r1=730026&r2=730027&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapSerializer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapSerializer.cpp Mon Dec 29 17:32:53 2008
@@ -59,6 +59,8 @@
     m_pNamespace = NULL;
     m_pContentIdSet = NULL;
     
+    reset();
+    
     logExit()
 }
 
@@ -284,20 +286,37 @@
 { 
     logEntryEngine("SoapSerializer::addOutputCmplxParam")
 
-    int    iSuccess = AXIS_SUCCESS;
-
-    Param * pParam = new Param();
-
-    pParam->m_Value.pCplxObj = new ComplexObjectHandler;
-    pParam->m_Value.pCplxObj->pObject = pObject;
-    pParam->m_Value.pCplxObj->pSZFunct = (AXIS_SERIALIZE_FUNCT) pSZFunct;
-    pParam->m_Value.pCplxObj->pDelFunct = (AXIS_OBJECT_DELETE_FUNCT) pDelFunct;
-    if( m_pSoapEnvelope &&
-        (m_pSoapEnvelope->m_pSoapBody) &&
-        (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod)) 
-        m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam);
+    int    iSuccess = AXIS_FAIL;
 
-    pParam->setName( pName);
+    if ( m_pSoapEnvelope 
+    		&& (m_pSoapEnvelope->m_pSoapBody) 
+    		&& (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
+    {
+	    Param * pParam = new Param();
+	
+	    pParam->m_Value.pCplxObj            = new ComplexObjectHandler;
+	    pParam->m_Value.pCplxObj->pObject   = pObject;
+	    pParam->m_Value.pCplxObj->pSZFunct  = (AXIS_SERIALIZE_FUNCT) pSZFunct;
+	    pParam->m_Value.pCplxObj->pDelFunct = (AXIS_OBJECT_DELETE_FUNCT) pDelFunct;
+
+	    // This check is to ensure backward compatibility...do not remove. It use to be we accepted
+	    // null string to indicate non-wrapper style, but this is no longer the case. So we
need
+	    // to set it to a value.
+	    
+	    AxisString sName = pName;
+	    if (sName.empty())
+	    {
+	    	sName  = m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->getPrefix();
+	    	sName += ":";
+	    	sName += m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->getMethodName();
+	    }
+	    
+	    pParam->setName( sName.c_str() );
+	    
+	    m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam );
+	    
+	    iSuccess = AXIS_SUCCESS;
+    }
     
     logExitWithReturnCode(iSuccess)
     
@@ -627,27 +646,37 @@
 {
     logEntryEngine("SoapSerializer::createSoapMethod")
 
-    if (NULL == m_pSoapEnvelope || NULL == m_pSoapEnvelope->m_pSoapBody)
-        return AXIS_FAIL;
-        
-    SoapMethod * pMethod = m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod;
-    if (pMethod == NULL)
+    int iStatus = AXIS_FAIL;
+
+    if (m_pSoapEnvelope 
+    		&& m_pSoapEnvelope->m_pSoapBody)
     {
-        pMethod = new SoapMethod();
-        setSoapMethod( pMethod);
+	    SoapMethod * pMethod = m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod;
+	    if (pMethod == NULL)
+	    {
+	        pMethod = new SoapMethod();
+	        setSoapMethod( pMethod);
+	    }
+	    
+	    // Ensure everything is cleared out if using existing method object.
+	    pMethod->reset();
+	    
+	    pMethod->setWrapperStyle(bIsWrapperStyle);
+	    pMethod->setLocalName( sLocalName);
+	    pMethod->setPrefix( getNamespacePrefix(sURI) );
+	    pMethod->setURI( sURI);
+	    
+	    // Since we want the bean to define the namespace for non-wrapper style, we need to
reset
+	    // the counter.  See SoapMethod::serialize() for further information.
+	    if (!bIsWrapperStyle)
+	        m_nCounter = 0;
+	    
+	    iStatus = AXIS_SUCCESS;
     }
-    
-    // Ensure everything is cleared out if using existing method object.
-    pMethod->reset();
-    
-    pMethod->setWrapperStyle(bIsWrapperStyle);
-    pMethod->setLocalName( sLocalName);
-    pMethod->setPrefix( getNamespacePrefix(sURI) );
-    pMethod->setURI( sURI);
 
-    logExitWithReturnCode(AXIS_SUCCESS)
+    logExitWithReturnCode(iStatus)
 
-    return AXIS_SUCCESS;
+    return iStatus;
 }
 
 int SoapSerializer::
@@ -937,31 +966,37 @@
  * Basic output parameter going to be serialized as an Element later
  */
 int SoapSerializer::
-addOutputParam( const AxisChar * pchName, void * pValue, XSDTYPE type)
+addOutputParam( const AxisChar * pchName,  // prefix and element name
+                void * pValue,             // value
+                XSDTYPE type)              // type
 {
     logEntryEngine("SoapSerializer::addOutputParam")
 
-    IAnySimpleType* xsdValue = AxisUtils::createSimpleTypeObject(pValue, type);
-    
-    Param * pParam = new Param();
-
     int iStatus = AXIS_FAIL;
     
-    if( pParam)
+    if ( m_pSoapEnvelope 
+    		&& (m_pSoapEnvelope->m_pSoapBody) 
+    		&& (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod)) 
     {
+        IAnySimpleType* xsdValue = AxisUtils::createSimpleTypeObject(pValue, type);
+
+    	Param * pParam = new Param();
+    	
         pParam->m_Type = type;
         pParam->m_sName = pchName;
         pParam->setValue(type, xsdValue);
         
-        if( m_pSoapEnvelope &&
-            (m_pSoapEnvelope->m_pSoapBody) &&
-            (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod)) 
+        m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam );
+        
+        // if non-wrapper then we need to add namespace to envelope since it will not get
added
+        // any other way.  non-wrapper support was added later so that is why we are in this
mess.
+        if (!(m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->isWrapperStyle()))
         {
-            m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam);
-            iStatus = AXIS_SUCCESS;
+            addNamespaceToEnvelope((AxisChar * )m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->getUri().c_str(),

+                                   (AxisChar * )m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->getPrefix().c_str());
         }
-        else
-            delete pParam;
+            
+        iStatus = AXIS_SUCCESS;
     }
 
     logExitWithReturnCode(iStatus)
@@ -990,8 +1025,9 @@
 
     return ret;
 }
-int SoapSerializer::serializeAsElement( const AxisChar * pName,
-                                        IAnySimpleType * pSimpleType)
+int SoapSerializer::
+serializeAsElement( const AxisChar * pName,
+                    IAnySimpleType * pSimpleType)
 {
     return serializeAsElement( pName, NULL, pSimpleType);
 }
@@ -1032,10 +1068,11 @@
     return iStatus;
 } 
 
-int SoapSerializer::serializeAsAttribute( const AxisChar * pName,
-                                          const AxisChar * pNamespace,
-                                          void * pValue,
-                                          XSDTYPE type)
+int SoapSerializer::
+serializeAsAttribute( const AxisChar * pName,
+                      const AxisChar * pNamespace,
+                      void * pValue,
+                      XSDTYPE type)
 {
     IAnySimpleType* pSimpleType = AxisUtils::createSimpleTypeObject(pValue, type);
     
@@ -1558,7 +1595,7 @@
 {
     logEntryEngine("SoapSerializer::reset")
 
-    m_nCounter = 0; // reset namespace prifix counter 
+    m_nCounter = 0; // reset namespace prefix counter 
 
     if( m_pSoapEnvelope )
         m_pSoapEnvelope->reset();

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected?rev=730027&r1=730026&r2=730027&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected
(original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/DocLitNonwrapperTests_ClientRequest.expected
Mon Dec 29 17:32:53 2008
@@ -1,71 +1,71 @@
-POST /axis/Operation HTTP/1.1
-Host: 127.0.0.1:13260
-Content-Type: text/xml; charset=UTF-8
-SOAPAction: ""
-Content-Length: 359
-
-<?xml version='1.0' encoding='utf-8' ?>
-<SOAP-ENV:Envelope 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://dom.w3c.org">
-<SOAP-ENV:Body>
-<ns1:inDocument>Input for operation 1</ns1:inDocument>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
-POST /axis/Operation HTTP/1.1
-Host: 127.0.0.1:13260
-Content-Type: text/xml; charset=UTF-8
-SOAPAction: ""
-Content-Length: 376
-
-<?xml version='1.0' encoding='utf-8' ?>
-<SOAP-ENV:Envelope 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://dom.w3c.org">
-<SOAP-ENV:Body>
-<ns1:Operation2Request><number1>2000</number1>
-</ns1:Operation2Request>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
-POST /axis/Operation HTTP/1.1
-Host: 127.0.0.1:13260
-Content-Type: text/xml; charset=UTF-8
-SOAPAction: ""
-Content-Length: 328
-
-<?xml version='1.0' encoding='utf-8' ?>
-<SOAP-ENV:Envelope 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://dom.w3c.org">
-<SOAP-ENV:Body>
-<ns1:Operation3Request/></SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
-POST /axis/Operation HTTP/1.1
-Host: 127.0.0.1:13260
-Content-Type: text/xml; charset=UTF-8
-SOAPAction: ""
-Content-Length: 459
-
-<?xml version='1.0' encoding='utf-8' ?>
-<SOAP-ENV:Envelope 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://dom.w3c.org">
-<SOAP-ENV:Body>
-<ns1:Operation4Request><record><field1>field4444401</field1>
-<field2>field4444402</field2>
-<field3>field4444403</field3>
-</record></ns1:Operation4Request>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
-POST /axis/Operation HTTP/1.1
-Host: 127.0.0.1:13260
-Content-Type: text/xml; charset=UTF-8
-SOAPAction: ""
-Content-Length: 459
-
-<?xml version='1.0' encoding='utf-8' ?>
-<SOAP-ENV:Envelope 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://dom.w3c.org">
-<SOAP-ENV:Body>
-<ns1:Operation5Request><record><field1>field5555501</field1>
-<field2>field5555502</field2>
-<field3>field5555503</field3>
-</record></ns1:Operation5Request>
-</SOAP-ENV:Body>
-</SOAP-ENV:Envelope>
-
+POST /axis/Operation HTTP/1.1
+Host: 127.0.0.1:13260
+Content-Type: text/xml; charset=UTF-8
+SOAPAction: ""
+Content-Length: 359
+
+<?xml version='1.0' encoding='utf-8' ?>
+<SOAP-ENV:Envelope 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://dom.w3c.org">
+<SOAP-ENV:Body>
+<ns1:inDocument>Input for operation 1</ns1:inDocument>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+POST /axis/Operation HTTP/1.1
+Host: 127.0.0.1:13260
+Content-Type: text/xml; charset=UTF-8
+SOAPAction: ""
+Content-Length: 376
+
+<?xml version='1.0' encoding='utf-8' ?>
+<SOAP-ENV:Envelope 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">
+<SOAP-ENV:Body>
+<ns1:Operation2Request xmlns:ns1="http://dom.w3c.org"><number1>2000</number1>
+</ns1:Operation2Request>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+POST /axis/Operation HTTP/1.1
+Host: 127.0.0.1:13260
+Content-Type: text/xml; charset=UTF-8
+SOAPAction: ""
+Content-Length: 329
+
+<?xml version='1.0' encoding='utf-8' ?>
+<SOAP-ENV:Envelope 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">
+<SOAP-ENV:Body>
+<ns1:Operation3Request xmlns:ns1="http://dom.w3c.org" /></SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+POST /axis/Operation HTTP/1.1
+Host: 127.0.0.1:13260
+Content-Type: text/xml; charset=UTF-8
+SOAPAction: ""
+Content-Length: 459
+
+<?xml version='1.0' encoding='utf-8' ?>
+<SOAP-ENV:Envelope 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">
+<SOAP-ENV:Body>
+<ns1:Operation4Request xmlns:ns1="http://dom.w3c.org"><record><field1>field4444401</field1>
+<field2>field4444402</field2>
+<field3>field4444403</field3>
+</record></ns1:Operation4Request>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+POST /axis/Operation HTTP/1.1
+Host: 127.0.0.1:13260
+Content-Type: text/xml; charset=UTF-8
+SOAPAction: ""
+Content-Length: 459
+
+<?xml version='1.0' encoding='utf-8' ?>
+<SOAP-ENV:Envelope 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">
+<SOAP-ENV:Body>
+<ns1:Operation5Request xmlns:ns1="http://dom.w3c.org"><record><field1>field5555501</field1>
+<field2>field5555502</field2>
+<field3>field5555503</field3>
+</record></ns1:Operation5Request>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+



Mime
View raw message