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 ro...@apache.org on 2004/06/01 19:35:07 UTC

cvs commit: ws-axis/c/src/soap Attribute.cpp SoapMethod.cpp SoapMethod.h SoapSerializer.cpp

roshan      2004/06/01 10:35:07

  Modified:    c/include/axis/client Stub.h
               c/include/axis/server SoapSerializer.h
               c/src/engine/client Stub.cpp
               c/src/soap Attribute.cpp SoapMethod.cpp SoapMethod.h
                        SoapSerializer.cpp
  Log:
  added support to set Attributes to the operation from the Stub
  
  Revision  Changes    Path
  1.5       +27 -0     ws-axis/c/include/axis/client/Stub.h
  
  Index: Stub.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/Stub.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Stub.h	1 Jun 2004 03:12:42 -0000	1.4
  +++ Stub.h	1 Jun 2004 17:35:06 -0000	1.5
  @@ -14,6 +14,7 @@
    *   limitations under the License.
    *
    * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
  + * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
    */
   
   /*
  @@ -28,6 +29,16 @@
    * Added setProxy
    */
   
  +/*
  + * Revision 1.2  2004/05/31 roshan
  + * Added calling conventions
  + */
  +
  +/*
  + * Revision 1.3  2004/06/01 roshan
  + * Added setSOAPMethodAttribute
  + */
  +
   #if !defined(_STUB_H____OF_AXIS_INCLUDED_)
   #define _STUB_H____OF_AXIS_INCLUDED_
   
  @@ -53,7 +64,18 @@
       */
       void setProxy(const char* pcProxyHost, unsigned int uiProxyPort);
   
  +	/**
  +	 * Sets a Attribute to the SOAPMethod, using the given Attribute data.
  +	 */
  +	void setSOAPMethodAttribute(const AxisChar *pLocalname, const AxisChar *pPrefix, const AxisChar *pValue);
  +
  +	/**
  +	 * Sets a Attribute to the SOAPMethod, using the given Attribute data.
  +	 */
  +	void setSOAPMethodAttribute(const AxisChar *pLocalname, const AxisChar *pPrefix, const AxisChar* pUri, const AxisChar *pValue);
  +
     protected:
  +	void setSOAPMethodAttributes();
       void applyUserPreferences();
       void setTransportProperties();
       void setSOAPHeaders();
  @@ -77,6 +99,11 @@
       */
       bool m_bUseProxy;
   
  +  private:
  +	/**
  +	 * List of SOAPMethod Attributes
  +	 */
  +    vector <Attribute*> m_vSOAPMethodAttributes;
   
   };
   
  
  
  
  1.17      +2 -0      ws-axis/c/include/axis/server/SoapSerializer.h
  
  Index: SoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/server/SoapSerializer.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SoapSerializer.h	18 May 2004 04:32:30 -0000	1.16
  +++ SoapSerializer.h	1 Jun 2004 17:35:06 -0000	1.17
  @@ -169,6 +169,8 @@
       BasicTypeSerializer m_BTSZ;
       SOAPTransport* m_pOutputStream;
   public:
  +	int setSOAPMethodAttribute(Attribute* pAttribute);
  +	SoapMethod* getSOAPMethod();
       IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName, 
           AxisChar *pachPrefix, AxisChar *pachUri);
       /* to add a header block to the Serializer. Probably by a handler */
  
  
  
  1.6       +38 -0     ws-axis/c/src/engine/client/Stub.cpp
  
  Index: Stub.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Stub.cpp	1 Jun 2004 03:12:42 -0000	1.5
  +++ Stub.cpp	1 Jun 2004 17:35:06 -0000	1.6
  @@ -14,6 +14,7 @@
    *   limitations under the License.
    *
    * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
  + * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
    */
   
   /*
  @@ -26,6 +27,16 @@
    * Added setProxy
    */
   
  +/*
  + * Revision 1.2  2004/05/31 roshan
  + * Added calling conventions
  + */
  +
  +/*
  + * Revision 1.3  2004/06/01 roshan
  + * Added setSOAPMethodAttribute
  + */
  +
   #include <axis/client/Stub.h>
   #include <stdio.h>
   
  @@ -137,6 +148,7 @@
   {
       setSOAPHeaders ();
       setTransportProperties ();
  +	setSOAPMethodAttributes();
   }
   
   void Stub::setProxy(const char* pcProxyHost, unsigned int uiProxyPort)
  @@ -159,4 +171,30 @@
               pTrasport->setProxy(m_strProxyHost, m_uiProxyPort);
           }
       }*/
  +}
  +
  +void Stub::setSOAPMethodAttribute(const AxisChar *pLocalname, const AxisChar *pPrefix, const AxisChar *pValue)
  +{
  +	Attribute* pAttribute = new Attribute(pLocalname, pPrefix, pValue);
  +	m_vSOAPMethodAttributes.push_back(pAttribute);
  +}
  +
  +void Stub::setSOAPMethodAttributes()
  +{
  +    SoapSerializer *pSerializer = NULL;
  +    if (m_pCall)
  +	pSerializer = m_pCall->getSOAPSerializer ();
  +    if (pSerializer)
  +    {
  +	for (unsigned int i = 0; i < m_vSOAPMethodAttributes.size (); i++)
  +	{
  +		pSerializer->setSOAPMethodAttribute(m_vSOAPMethodAttributes[i]->clone());
  +	}
  +    }	
  +}
  +
  +void Stub::setSOAPMethodAttribute(const AxisChar *pLocalname, const AxisChar *pPrefix, const AxisChar *pUri, const AxisChar *pValue)
  +{
  +    Attribute* pAttribute = new Attribute(pLocalname, pPrefix, pUri, pValue);
  +	m_vSOAPMethodAttributes.push_back(pAttribute);
   }
  
  
  
  1.18      +1 -0      ws-axis/c/src/soap/Attribute.cpp
  
  Index: Attribute.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/Attribute.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Attribute.cpp	26 May 2004 05:14:53 -0000	1.17
  +++ Attribute.cpp	1 Jun 2004 17:35:06 -0000	1.18
  @@ -143,6 +143,7 @@
               if (blnIsNewNamespace)
               {
                   lstTmpNameSpaceStack.push_back((AxisChar*)m_uri.c_str());
  +				pSZ.serialize("xmlns:", m_prefix.c_str(), "=\"", m_uri.c_str(), "\" ", NULL);
               }
   
               pSZ.serialize(m_prefix.c_str(), ":", NULL);
  
  
  
  1.23      +18 -4     ws-axis/c/src/soap/SoapMethod.cpp
  
  Index: SoapMethod.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapMethod.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SoapMethod.cpp	26 Apr 2004 04:04:37 -0000	1.22
  +++ SoapMethod.cpp	1 Jun 2004 17:35:06 -0000	1.23
  @@ -15,7 +15,7 @@
    */
   
   /*
  - * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
  + * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
    *
    */
   
  @@ -86,7 +86,9 @@
                   " xmlns:", m_strPrefix.c_str(),
                   "=\"", m_strUri.c_str(), "\"", NULL);
   
  -            iStatus= serializeAttributes(pSZ);
  +			list<AxisChar*> lstTmpNameSpaceStack;
  +
  +            iStatus= serializeAttributes(pSZ, lstTmpNameSpaceStack);
               if(iStatus==AXIS_FAIL)
               {
                   break;
  @@ -109,6 +111,17 @@
               
               pSZ.serialize(m_strLocalname.c_str(), ">", NULL);
   
  +			/*
  +			 * Removing the namespace list of this SOAPMethod from the stack.
  +			 */
  +			list<AxisChar*>::iterator itCurrentNamespace = 
  +				lstTmpNameSpaceStack.begin();
  +			while (itCurrentNamespace != lstTmpNameSpaceStack.end())
  +			{
  +				pSZ.removeNamespacePrefix(*itCurrentNamespace);
  +				itCurrentNamespace++;
  +			}
  +
               iStatus= AXIS_SUCCESS;
           }
           else
  @@ -229,13 +242,14 @@
       return AXIS_SUCCESS;
   }
   
  -int SoapMethod::serializeAttributes(SoapSerializer& pSZ)
  +int SoapMethod::serializeAttributes(SoapSerializer& pSZ, 
  +        list<AxisChar*>& lstTmpNameSpaceStack)
   {
       list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
   
       while(itCurrAttribute != m_attributes.end())
       {        
  -        (*itCurrAttribute)->serialize(pSZ);
  +        (*itCurrAttribute)->serialize(pSZ, lstTmpNameSpaceStack);
           itCurrAttribute++;        
       }    
   
  
  
  
  1.18      +2 -2      ws-axis/c/src/soap/SoapMethod.h
  
  Index: SoapMethod.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapMethod.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SoapMethod.h	26 Apr 2004 04:04:37 -0000	1.17
  +++ SoapMethod.h	1 Jun 2004 17:35:06 -0000	1.18
  @@ -52,14 +52,14 @@
   
   
   
  -    @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
  +    @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
   
   class SoapMethod : public ISoapMethod
   {
   
   private:
  -    int serializeAttributes(SoapSerializer& pSZ);
  +    int serializeAttributes(SoapSerializer& pSZ, list<AxisChar*>& lstTmpNameSpaceStack);
       /* int serializeAttributes(string& sSerialized); */
       list<Attribute*> m_attributes;
       bool isSerializable();    
  
  
  
  1.51      +23 -3     ws-axis/c/src/soap/SoapSerializer.cpp
  
  Index: SoapSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- SoapSerializer.cpp	31 May 2004 03:47:49 -0000	1.50
  +++ SoapSerializer.cpp	1 Jun 2004 17:35:06 -0000	1.51
  @@ -15,7 +15,7 @@
    */
   
   /*
  - * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
  + * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
    * @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)
    *
    */
  @@ -117,8 +117,11 @@
   
       if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody))
       {
  -        m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod= pSoapMethod;
  -        intStatus= AXIS_SUCCESS;
  +		if (!(m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod)) {
  +			m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod= pSoapMethod;
  +		}
  +			
  +		intStatus= AXIS_SUCCESS;
       }
   
       return intStatus;
  @@ -827,4 +830,21 @@
           pachUri);
       setHeaderBlock(pHeaderBlock);
       return pHeaderBlock;    
  +}
  +
  +SoapMethod* SoapSerializer::getSOAPMethod()
  +{
  +	/*
  +	 *TODO
  +	 * return the SOAPMethod object if one is available. If not available create a SOAPMethod and set it and return it.
  +	 */
  +
  +	return NULL;
  +}
  +
  +int SoapSerializer::setSOAPMethodAttribute(Attribute *pAttribute)
  +{
  +	m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addAttribute(pAttribute);
  +
  +	return AXIS_SUCCESS;
   }