You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/06/08 06:25:08 UTC

cvs commit: ws-axis/c/include/axis IWrapperSoapSerializer.hpp

samisa      2005/06/07 21:25:08

  Modified:    c/src/engine/client Call.cpp
               c/src/soap SoapHeader.cpp SoapHeader.h SoapMethod.cpp
                        SoapMethod.h SoapSerializer.cpp SoapSerializer.h
               c/include/axis IWrapperSoapSerializer.hpp
  Log:
  Changes to move AxisClientEngine::initialize() to call constructor from Call::initialize()
  This change required some changes to Serializer and other SOAP related classes, mainly related to resetting stuff between method calls
  
  Revision  Changes    Path
  1.114     +20 -7     ws-axis/c/src/engine/client/Call.cpp
  
  Index: Call.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- Call.cpp	2 Jun 2005 03:23:30 -0000	1.113
  +++ Call.cpp	8 Jun 2005 04:25:07 -0000	1.114
  @@ -97,6 +97,15 @@
   
   			m_nStatus = m_pTransport->setTransportProperty( SECURE_PROPERTIES, (const char *) &sArguments);
   		}
  +
  +        // Engine initialization
  +        m_pAxisEngine = new ClientAxisEngine ();
  +        if (!m_pAxisEngine) 
  +        {
  +        	m_nStatus = AXIS_FAIL;
  +        }
  +        m_nStatus = m_pAxisEngine->initialize ();
  +
       }
       catch( AxisException& e)
       {
  @@ -203,7 +212,7 @@
       try
       {
           m_nStatus = AXIS_SUCCESS;
  -        
  +       /* 
           if (m_pAxisEngine)
               delete m_pAxisEngine;
           m_pAxisEngine = new ClientAxisEngine ();
  @@ -212,7 +221,7 @@
               return AXIS_FAIL;
           }
           if (AXIS_SUCCESS == m_pAxisEngine->initialize ())
  -        {
  +        {*/
               MessageData *msgData = m_pAxisEngine->getMessageData ();
               if (msgData)
               {
  @@ -234,6 +243,10 @@
                   {
                       m_pIWSSZ->setCurrentProviderType (nStyle);
                       m_pIWSDZ->setCurrentProviderType (nStyle);
  +
  +                    m_pIWSSZ->reset();
  +                    m_pIWSDZ->init();
  +                    
                       switch (nStyle)
                       {
                           case C_RPC_PROVIDER:
  @@ -261,7 +274,7 @@
               }
               m_nStatus = AXIS_FAIL;
               return AXIS_FAIL;
  -        }
  +        //}
           m_nStatus = AXIS_FAIL;        
           return AXIS_FAIL;
       }
  @@ -283,12 +296,12 @@
   int Call::unInitialize ()
   {
       m_bCallInitialized = false;
  -    if (m_pAxisEngine)
  +    /*if (m_pAxisEngine)
       {
  -		/* Initialization,serialization, invokation or check message success */
  +		//Initialization,serialization, invokation or check message success 
   		if ( m_nStatus == AXIS_SUCCESS &&  m_pIWSDZ != NULL ) 
   		{
  -			/* Test if deserialization failed */
  +			// Test if deserialization failed 
   			m_nStatus = m_pIWSDZ->getStatus();
   		}
   		MessageData *msgData = m_pAxisEngine->getMessageData();	
  @@ -313,7 +326,7 @@
           m_pAxisEngine->unInitialize ();
           delete m_pAxisEngine;
           m_pAxisEngine = NULL;
  -    }
  +    }*/
       closeConnection ();
       return AXIS_SUCCESS;
   }
  
  
  
  1.38      +20 -0     ws-axis/c/src/soap/SoapHeader.cpp
  
  Index: SoapHeader.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapHeader.cpp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- SoapHeader.cpp	23 Mar 2005 15:44:59 -0000	1.37
  +++ SoapHeader.cpp	8 Jun 2005 04:25:08 -0000	1.38
  @@ -310,5 +310,25 @@
       
       return iStatus;
   }
  +void SoapHeader::clear()
  +{
  +    /*
  +     * header blocks are not deleted here any more. Its the responsibility of
  +     * either a handler or stub etc to delete any header block created by them
  +     */
  +    m_headerBlocks.clear();
  +
  +    /* deletion of attributes */
  +    list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
  +
  +    while(itCurrAttribute != m_attributes.end())
  +    {
  +        delete *itCurrAttribute;
  +        itCurrAttribute++;
  +    }
  +
  +    m_attributes.clear();
  +}
  +
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.17      +2 -0      ws-axis/c/src/soap/SoapHeader.h
  
  Index: SoapHeader.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapHeader.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SoapHeader.h	23 Mar 2005 15:44:59 -0000	1.16
  +++ SoapHeader.h	8 Jun 2005 04:25:08 -0000	1.17
  @@ -160,6 +160,8 @@
         * The Destructor.
         */
       virtual ~SoapHeader();
  +
  +    void clear();
   };
   AXIS_CPP_NAMESPACE_END
   #endif 
  
  
  
  1.32      +15 -103   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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- SoapMethod.cpp	9 Feb 2005 11:30:54 -0000	1.31
  +++ SoapMethod.cpp	8 Jun 2005 04:25:08 -0000	1.32
  @@ -32,18 +32,13 @@
   
   SoapMethod::~SoapMethod()
   {
  -    list<Param*>::iterator itParam;
       for (list<Attribute*>::iterator it = m_attributes.begin();
  -    it != m_attributes.end(); it++)
  +         it != m_attributes.end(); it++)
       {
           delete (*it);
       }
  -    for (itParam = m_OutputParams.begin(); 
  -    itParam != m_OutputParams.end(); itParam++)
  -    {
  -        delete (*itParam);
  -    }
  -    m_OutputParams.clear();
  +
  +    clearOutParams();
   }
   
   void SoapMethod::setPrefix(const AxisChar* prefix)
  @@ -141,59 +136,6 @@
       return iStatus;
   }
   
  -/*
  -comm on 11/7/2003 9.10am
  -int SoapMethod::serialize(string& sSerialized)
  -{    
  -    
  -    int iStatus= AXIS_SUCCESS;
  -
  -    do {
  -        if(isSerializable()) {
  -
  -            sSerialized+= "<" + m_strPrefix+ ":"+ m_strLocalname+ " xmlns:"
  -            + m_strPrefix+ "=\""+ m_strUri+ "\"";
  -            
  -//            if(m_strPrefix.length() != 0) {
  -//                sSerialized+= m_strPrefix+ ":";
  -//            }
  -
  -//            sSerialized+= m_strLocalname;
  -
  -//            if(m_strPrefix.length() != 0) {
  -//                sSerialized+= " xmlns:"+ m_strPrefix+ "=\""+ m_strUri+ "\"";
  -//            }
  -
  -            iStatus= serializeAttributes(sSerialized);
  -            if(iStatus==AXIS_FAIL) {
  -                break;
  -            }
  -
  -            sSerialized+= ">";
  -
  -            iStatus= serializeOutputParam(sSerialized);
  -            if(iStatus==AXIS_FAIL) {
  -                break;
  -            }
  -
  -            sSerialized+= "</";
  -
  -            if(m_strPrefix.length() != 0) {
  -                sSerialized+= m_strPrefix+ ":";            
  -            }
  -
  -            sSerialized+= m_strLocalname+ ">"+ "\n";
  -
  -            iStatus= AXIS_SUCCESS;
  -        } else {
  -            iStatus= AXIS_FAIL;
  -        }
  -    } while(0);
  -            
  -    return iStatus;
  -}
  -*/
  -
   int SoapMethod::serializeOutputParam(SoapSerializer& pSZ)
   {    
       int nStatus;
  @@ -208,14 +150,6 @@
       return AXIS_SUCCESS;
   }
   
  -/*
  -comm on 11/7/2003 9.10am
  -int SoapMethod::serializeOutputParam(string& sSerialized)
  -{    
  -    return m_pOutputParam->serialize(sSerialized);
  -}
  -*/
  -
   const AxisChar* SoapMethod::getMethodName()
   {
       return m_strLocalname.c_str();
  @@ -264,21 +198,6 @@
       return AXIS_SUCCESS;    
   }
   
  -/*
  -comm on 11/7/2003 9.10am
  -int SoapMethod::serializeAttributes(string &sSerialized)
  -{
  -    list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
  -
  -    while(itCurrAttribute != m_attributes.end()) {        
  -        (*itCurrAttribute)->serialize(sSerialized);
  -        itCurrAttribute++;        
  -    }    
  -
  -    return AXIS_SUCCESS;    
  -}
  -*/
  -
   int SoapMethod::reset()
   {
       m_strUri = "";
  @@ -290,25 +209,18 @@
       return AXIS_SUCCESS;
   }
   
  -AXIS_CPP_NAMESPACE_END
  -
  -#ifdef UNIT_TESTING_ON
  -int SoapMethod::initializeForTesting()
  +void SoapMethod::clearOutParams()
   {
  -    m_strPrefix = "mn";
  -    m_strLocalname = "add";
  -    m_strUri = "http://myurl.com";
  -
  -    Attribute* pAttribute = new Attribute();
  -    pAttribute->initializeForTesting();
  -    addAttribute(pAttribute);
  -
  -    /*
  -     * Param* pParam = new Param(100);
  -     * AddOutputParam(pParam);
  -     */
  -
  -    return AXIS_SUCCESS;
  +    if ( m_OutputParams.empty() )
  +        return;
  +    list<Param*>::iterator itParam;
  +    for (itParam = m_OutputParams.begin(); 
  +         itParam != m_OutputParams.end(); itParam++)
  +    {
  +        delete (*itParam);
  +    }
  +    m_OutputParams.clear();
   }
  -#endif
  +
  +AXIS_CPP_NAMESPACE_END
   
  
  
  
  1.23      +6 -0      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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SoapMethod.h	9 Feb 2005 11:30:54 -0000	1.22
  +++ SoapMethod.h	8 Jun 2005 04:25:08 -0000	1.23
  @@ -95,6 +95,12 @@
       void setPrefix(const AxisChar* prefix);
       SoapMethod();
       virtual ~SoapMethod();
  +
  +  /**
  +    * This methos will clear up all the current out params in preperation of a 
  +    * new method call
  +    */
  +    void clearOutParams();
   };
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.117     +13 -0     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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- SoapSerializer.cpp	1 Jun 2005 14:22:55 -0000	1.116
  +++ SoapSerializer.cpp	8 Jun 2005 04:25:08 -0000	1.117
  @@ -1303,4 +1303,17 @@
       return iStatus; // Can it only be successful?
   }
   
  +void SoapSerializer::reset()
  +{
  +    if( m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
  +    {
  +        m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->reset();    
  +    }
  +
  +    if( m_pSoapEnvelope && m_pSoapEnvelope->m_pSoapHeader )
  +    {
  +        m_pSoapEnvelope->m_pSoapHeader->clear();
  +    }
  +}
  +
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.48      +6 -0      ws-axis/c/src/soap/SoapSerializer.h
  
  Index: SoapSerializer.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- SoapSerializer.h	1 Jun 2005 14:22:55 -0000	1.47
  +++ SoapSerializer.h	8 Jun 2005 04:25:08 -0000	1.48
  @@ -229,6 +229,12 @@
       int serializeAsChardata(void* pValue, XSDTYPE type);
   	AxisXMLString getNamespaceURL( string sNameSpace);
       int deleteHeaderBlock(const AxisChar* pName, const AxisChar* pNamespace);    
  +
  +  /**
  +    * This methos will clear up all the current out params in preperation of a 
  +    * new method call
  +    */
  +    void reset();
   };
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.11      +6 -0      ws-axis/c/include/axis/IWrapperSoapSerializer.hpp
  
  Index: IWrapperSoapSerializer.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/IWrapperSoapSerializer.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- IWrapperSoapSerializer.hpp	3 Jun 2005 10:43:48 -0000	1.10
  +++ IWrapperSoapSerializer.hpp	8 Jun 2005 04:25:08 -0000	1.11
  @@ -175,6 +175,12 @@
       *     
       */
   	virtual ISoapAttachment* createSoapAttachement()=0;
  +
  +  /**
  +    * This methos will clear up all the current out params in preperation of a 
  +    * new method call
  +    */
  +    virtual void reset() = 0;
   };
   
   AXIS_CPP_NAMESPACE_END