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 da...@apache.org on 2004/06/23 11:56:33 UTC

cvs commit: ws-axis/c/tests/client/stubTest/stubBase InteropBaseClient.cpp InteropTestPortType.cpp

damitha     2004/06/23 02:56:33

  Modified:    c/samples/server/rpcfault MathOpsWrapper.cpp
               c/src/common AxisConfigException.cpp
               c/src/engine AxisEngineException.cpp
               c/src/soap AxisSoapException.cpp SoapDeSerializer.cpp
               c/src/transport/axis AxisTransport.cpp
                        AxisTransportException.cpp HttpTransport.cpp
                        HttpTransport.hpp Receiver.cpp Transport.hpp
               c/src/wsdd AxisWsddException.cpp
               c/src/xml AxisParseException.cpp
               c/src/xml/expat XMLParserExpat.cpp
               c/tests/client/exceptionTest MathOpsClient.cpp
               c/tests/client/stubTest/stubBase InteropBaseClient.cpp
                        InteropTestPortType.cpp
  Log:
  
  
  Revision  Changes    Path
  1.12      +4 -0      ws-axis/c/samples/server/rpcfault/MathOpsWrapper.cpp
  
  Index: MathOpsWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/MathOpsWrapper.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MathOpsWrapper.cpp	14 Jun 2004 06:25:19 -0000	1.11
  +++ MathOpsWrapper.cpp	23 Jun 2004 09:56:32 -0000	1.12
  @@ -105,6 +105,10 @@
   			(void*) Axis_Delete_DivByZeroStruct,"DivByZero", Axis_URI_DivByZeroStruct);
   		throw;
   	}
  +        catch(...)
  +        {
  +            throw;
  +        }
   
   }
   
  
  
  
  1.9       +2 -1      ws-axis/c/src/common/AxisConfigException.cpp
  
  Index: AxisConfigException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisConfigException.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AxisConfigException.cpp	23 Jun 2004 04:22:24 -0000	1.8
  +++ AxisConfigException.cpp	23 Jun 2004 09:56:32 -0000	1.9
  @@ -80,7 +80,8 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    delete pcMessage;
  +    if(pcMessage)
  +        delete pcMessage;
   }
   
   const string AxisConfigException::getMessage (const exception* objException)
  
  
  
  1.9       +2 -1      ws-axis/c/src/engine/AxisEngineException.cpp
  
  Index: AxisEngineException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/AxisEngineException.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AxisEngineException.cpp	23 Jun 2004 04:22:24 -0000	1.8
  +++ AxisEngineException.cpp	23 Jun 2004 09:56:32 -0000	1.9
  @@ -79,7 +79,8 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    //delete pcMessage;
  +    if(pcMessage)
  +        delete pcMessage;
   }
   const string AxisEngineException::getMessage (const exception* objException)
   {
  
  
  
  1.10      +2 -1      ws-axis/c/src/soap/AxisSoapException.cpp
  
  Index: AxisSoapException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/AxisSoapException.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AxisSoapException.cpp	23 Jun 2004 04:22:24 -0000	1.9
  +++ AxisSoapException.cpp	23 Jun 2004 09:56:32 -0000	1.10
  @@ -79,7 +79,8 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    delete pcMessage;
  +    if(pcMessage)
  +        delete pcMessage;
   }
   const string AxisSoapException::getMessage (const exception* objException)
   {
  
  
  
  1.64      +7 -2      ws-axis/c/src/soap/SoapDeSerializer.cpp
  
  Index: SoapDeSerializer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- SoapDeSerializer.cpp	14 Jun 2004 14:15:34 -0000	1.63
  +++ SoapDeSerializer.cpp	23 Jun 2004 09:56:32 -0000	1.64
  @@ -341,9 +341,14 @@
       try
       {
       /* check and skip the soap body tag */
  -    if (AXIS_SUCCESS != getBody()) return AXIS_FAIL;    
  +    if (AXIS_SUCCESS != getBody()) 
  +        //return AXIS_FAIL;    
  +        throw AxisException(SERVER_UNKNOWN_ERROR);
  +       
       if (!m_pNode) m_pNode = m_pParser->next();
  -    if (!m_pNode || (START_ELEMENT != m_pNode->m_type)) return AXIS_FAIL;
  +    if (!m_pNode || (START_ELEMENT != m_pNode->m_type))
  +        //return AXIS_FAIL;
  +        throw AxisException(SERVER_UNKNOWN_ERROR);
       //if (0 != strcmp(m_pNode->m_pchNameOrValue, pName)) return AXIS_FAIL;
       if (0 != strcmp(m_pNode->m_pchNameOrValue, pName))
       {
  
  
  
  1.32      +1 -0      ws-axis/c/src/transport/axis/AxisTransport.cpp
  
  Index: AxisTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/AxisTransport.cpp,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- AxisTransport.cpp	14 Jun 2004 08:00:47 -0000	1.31
  +++ AxisTransport.cpp	23 Jun 2004 09:56:32 -0000	1.32
  @@ -239,6 +239,7 @@
           try
           {
               m_pcReceived = m_pReceiver->Recv();
  +            AXISTRACE1("CAME4", INFO);
               if (m_pcReceived)
                   m_iBytesLeft = strlen(m_pcReceived);
               else
  
  
  
  1.9       +3 -1      ws-axis/c/src/transport/axis/AxisTransportException.cpp
  
  Index: AxisTransportException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/AxisTransportException.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AxisTransportException.cpp	23 Jun 2004 09:34:41 -0000	1.8
  +++ AxisTransportException.cpp	23 Jun 2004 09:56:32 -0000	1.9
  @@ -78,7 +78,9 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    delete pcMessage;
  +    m_sMessage = getMessage(iExceptionCode);
  +    if(pcMessage)
  +        delete pcMessage;
   }
   const string AxisTransportException::getMessage (const exception* objException)
   {
  
  
  
  1.37      +35 -4     ws-axis/c/src/transport/axis/HttpTransport.cpp
  
  Index: HttpTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/HttpTransport.cpp,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- HttpTransport.cpp	21 Jun 2004 12:08:51 -0000	1.36
  +++ HttpTransport.cpp	23 Jun 2004 09:56:32 -0000	1.37
  @@ -183,6 +183,8 @@
   HttpTransport::operator >> (const char **pPayLoad)
   {
       std::string tmpPacket;	/* use temporary, need to workout for this */
  +    try
  +    {
       if (!m_bStatus)
       {
   	/* We have the payload; this is due to Fault request made in */
  @@ -191,8 +193,6 @@
   	
   	return *this;
       }
  -    try
  -    {
           /* Http header is processed and validated. We now receive the payload */
           /* from the channel */
           if (m_IsHttpHeader == 1)
  @@ -263,6 +263,7 @@
       }
       catch(AxisTransportException& e)
       {
  +  
           throw;
       }
       catch(AxisException& e)
  @@ -412,7 +413,14 @@
   
   bool HttpTransport::GetStatus (const std::string & p_HttpPacket)
   {
  -    HTTPValidate (p_HttpPacket);
  +    try
  +    {
  +        HTTPValidate (p_HttpPacket);
  +    }
  +    catch(AxisTransportException& e)
  +    {
  +        throw;
  +    }
       return m_bStatus;
   }
   
  @@ -581,7 +589,8 @@
       char* pcMessage;// To hold Http error code message
   
       m_sHeader += p_HttpPacket;
  -
  +    try
  +    {
       std::string::size_type pos, nxtpos;
       pos = p_HttpPacket.find ("\r\n\r\n");	/*Search for end of http header */
       if (pos == std::string::npos)
  @@ -662,6 +671,15 @@
       }
       else
   	THROW_AXIS_TRANSPORT_EXCEPTION(SERVER_TRANSPORT_UNKNOWN_HTTP_RESPONSE);
  +    }
  +    catch(AxisTransportException& e)
  +    {
  +        throw;
  +    }
  +    catch(...)
  +    {
  +        throw;
  +    }
   
   }
   
  @@ -707,6 +725,19 @@
   	{
   	    chunked = true;
   	}
  +        if ((pos = strLine.find ("Content-Type:")) != std::string::npos)
  +        {
  +            std::string strContentType = strLine.substr
  +                (pos + strlen("Content-Type: ") + 5, 3).c_str ();
  +            if("xml" != strContentType)
  +            {
  +                AXISTRACE1("SERVER_TRANSPORT_PROCESS_EXCEPTION:content type is not xml", INFO);
  +                char* pcMessage = new char[256 * sizeof(char)];
  +                strcpy(pcMessage, "Content type is not xml");
  +	        THROW_AXIS_TRANSPORT_EXCEPTION2(SERVER_TRANSPORT_PROCESS_EXCEPTION, pcMessage);
  +            }
  +                
  +        }
       }
       m_PayLoad = p_HttpPacket.substr (offset);	/* rest from the offset is payload */
   
  
  
  
  1.8       +1 -1      ws-axis/c/src/transport/axis/HttpTransport.hpp
  
  Index: HttpTransport.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/HttpTransport.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HttpTransport.hpp	13 Jun 2004 11:48:40 -0000	1.7
  +++ HttpTransport.hpp	23 Jun 2004 09:56:32 -0000	1.8
  @@ -102,7 +102,7 @@
       void  SetProperty(const char* p_Property, const char* p_Value);
   
       /* Read from a HTTP transport handler and store read payload */
  -    const Transport& operator >> (const char** pPayload);
  +    const Transport& operator >> (const char** pPayload); 
   
       /* Write a given payload by using HTTP transport as carrier */
       const Transport& operator << (const char* p_Payload);
  
  
  
  1.22      +25 -18    ws-axis/c/src/transport/axis/Receiver.cpp
  
  Index: Receiver.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/Receiver.cpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Receiver.cpp	13 Jun 2004 11:48:40 -0000	1.21
  +++ Receiver.cpp	23 Jun 2004 09:56:32 -0000	1.22
  @@ -37,6 +37,8 @@
         int bodyLength;
         int isHttpHeader;
       const char* pToReturn = NULL;
  +    try
  +    {
         isHttpHeader = m_pTrChannel->getIsHttpHeader();
         bodyLength = m_pTrChannel->getBodyLength();
         /* printf("bodyLength:%d\n", bodyLength); */
  @@ -45,11 +47,7 @@
               return NULL;
       if (0 == m_BytesRead)
       {
  -        try
  -        {
  -#ifdef _DEBUG
  -                    printf("try\n");
  -#endif
  +
               *m_pTrChannel >> (&m_pMsg);
                       if(m_pMsg == NULL)
               {
  @@ -57,21 +55,21 @@
                           return NULL;
               }
               m_MsgSize = strlen(m_pMsg);        
  -	}
  -        catch(AxisException& ex)
  -        {
  +	//}
  +        //catch(AxisException& ex)
  +        //{
               /* Get the fault message. */
  -            *m_pTrChannel >> (&m_pMsg);
  -            m_MsgSize = strlen(m_pMsg);
  -            #ifdef _DEBUG
  +          //  *m_pTrChannel >> (&m_pMsg);
  +          //  m_MsgSize = strlen(m_pMsg);
  +          //  #ifdef _DEBUG
               /*    std::cerr << ex.GetErrorMsg() << std::endl; */
  -            #endif
  -	}
  -        catch(...)
  -        {
  -            AXISTRACE1("SERVER_TRANSPORT_RECEPTION_EXCEPTION", CRITICAL);
  -            throw AxisTransportException(SERVER_TRANSPORT_RECEPTION_EXCEPTION);
  -	}
  +          //  #endif
  +	//}
  +        //catch(...)
  +        //{
  +          //  AXISTRACE1("SERVER_TRANSPORT_RECEPTION_EXCEPTION", CRITICAL);
  +          //  throw AxisTransportException(SERVER_TRANSPORT_RECEPTION_EXCEPTION);
  +	//}
       }
           /* printf("m_MsgSize:%d\n", m_MsgSize); */
       if (m_MsgSize > 0)
  @@ -95,6 +93,15 @@
       {
               printf("m_MsgSize == 0, so return NULL\n");
           return NULL;
  +    }
  +    }
  +    catch(AxisTransportException& e)
  +    {
  +        throw;
  +    }
  +    catch(...)
  +    {
  +        throw;
       }
   }
   
  
  
  
  1.5       +1 -1      ws-axis/c/src/transport/axis/Transport.hpp
  
  Index: Transport.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis/Transport.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Transport.hpp	8 Jun 2004 12:02:02 -0000	1.4
  +++ Transport.hpp	23 Jun 2004 09:56:32 -0000	1.5
  @@ -58,7 +58,7 @@
       virtual void SetProperty(const char* p_Property, const char* p_Value)=0;
   
   
  -    virtual const Transport& operator >> (const char** pMsg){*pMsg=NULL;return *this;}
  +    virtual const Transport& operator >> (const char** pMsg) {*pMsg=NULL;return *this;}
       virtual const Transport& operator << (const char* msg)=0;
       virtual void ClearAdditionalHeaders(){};
       virtual int getBodyLength() = 0;
  
  
  
  1.9       +2 -1      ws-axis/c/src/wsdd/AxisWsddException.cpp
  
  Index: AxisWsddException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/AxisWsddException.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AxisWsddException.cpp	23 Jun 2004 04:22:24 -0000	1.8
  +++ AxisWsddException.cpp	23 Jun 2004 09:56:32 -0000	1.9
  @@ -79,7 +79,8 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    delete pcMessage;
  +    if(pcMessage)
  +        delete pcMessage;
   }
   const string AxisWsddException::getMessage (const exception* objException)
   {
  
  
  
  1.5       +2 -1      ws-axis/c/src/xml/AxisParseException.cpp
  
  Index: AxisParseException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/xml/AxisParseException.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AxisParseException.cpp	23 Jun 2004 04:22:24 -0000	1.4
  +++ AxisParseException.cpp	23 Jun 2004 09:56:32 -0000	1.5
  @@ -78,7 +78,8 @@
   {
       AxisString sMessage = strdup(pcMessage);
       m_sMessage = getMessage(iExceptionCode) + " " + sMessage;
  -    delete pcMessage;
  +    if(pcMessage)
  +        delete pcMessage;
   }
   const string AxisParseException::getMessage (const exception* objException)
   {
  
  
  
  1.5       +2 -0      ws-axis/c/src/xml/expat/XMLParserExpat.cpp
  
  Index: XMLParserExpat.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/xml/expat/XMLParserExpat.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLParserExpat.cpp	23 Jun 2004 04:22:24 -0000	1.4
  +++ XMLParserExpat.cpp	23 Jun 2004 09:56:32 -0000	1.5
  @@ -165,6 +165,7 @@
               nStatus = parseNext();
               if (TRANSPORT_FAILED == nStatus) return NULL;
               if ((TRANSPORT_FINISHED == nStatus) && m_Events.empty())
  +                //throw AxisParseException(SERVER_PARSE_TRANSPORT_FAILED);
                   return NULL;
               if (AXIS_FAIL == m_nStatus) return NULL;
           }
  @@ -181,6 +182,7 @@
                   nStatus = parseNext();
                   if (TRANSPORT_FAILED == nStatus) return NULL;
                   if ((TRANSPORT_FINISHED == nStatus) && m_Events.empty()) 
  +                    //throw AxisParseException(SERVER_PARSE_TRANSPORT_FAILED);
                       return NULL;
               }
               else
  
  
  
  1.3       +2 -1      ws-axis/c/tests/client/exceptionTest/MathOpsClient.cpp
  
  Index: MathOpsClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/client/exceptionTest/MathOpsClient.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MathOpsClient.cpp	22 Jun 2004 12:06:20 -0000	1.2
  +++ MathOpsClient.cpp	23 Jun 2004 09:56:33 -0000	1.3
  @@ -27,7 +27,8 @@
   		port = argv[2];
   	}
   	printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
  -	sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
  +	//sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
  +	sprintf(endpoint, "http://%s:%s/", server, port);
   	MathOps ws(endpoint);
   
   	op = argv[3];
  
  
  
  1.10      +11 -0     ws-axis/c/tests/client/stubTest/stubBase/InteropBaseClient.cpp
  
  Index: InteropBaseClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/client/stubTest/stubBase/InteropBaseClient.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- InteropBaseClient.cpp	21 Jun 2004 13:14:02 -0000	1.9
  +++ InteropBaseClient.cpp	23 Jun 2004 09:56:33 -0000	1.10
  @@ -134,10 +134,21 @@
       }
       strcpy(buffer1, bigstring.c_str());
       //printf(ws.echoString(buffer1));
  +    try
  +    {
       if (0 == strcmp(ws.echoString("hello world"), "hello world"))
   	printf("successful\n");
       else
   	printf("failed\n");
  +    }
  +    catch(AxisException& e)
  +    {
  +        printf("%s\n", e.what());
  +    }
  +    catch(...)
  +    {
  +        printf("Unknown exception\n");
  +    }
   
       printf("Test trasport property accessors\n");
       printf("First trasport key = %s\n", ws.getFirstTrasportPropertyKey());
  
  
  
  1.3       +30 -0     ws-axis/c/tests/client/stubTest/stubBase/InteropTestPortType.cpp
  
  Index: InteropTestPortType.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/client/stubTest/stubBase/InteropTestPortType.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InteropTestPortType.cpp	21 Jun 2004 13:14:02 -0000	1.2
  +++ InteropTestPortType.cpp	23 Jun 2004 09:56:33 -0000	1.3
  @@ -33,7 +33,13 @@
    */
   xsd__string InteropTestPortType::echoString(xsd__string Value0)
   {
  +    char* cFaultcode;
  +        char* cFaultstring;
  +        char* cFaultactor;
  +        char* cFaultdetail;
   	xsd__string Ret;
  +    try
  +    {
   	if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
   	m_pCall->setTransportProperty(SOAPACTION_HEADER , "base#echoString");
   	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  @@ -48,6 +54,30 @@
   			Ret = m_pCall->getElementAsString("return", 0);
   		}
   	}
  +        }
  +        catch(AxisException& e)
  +        {
  +                int iExceptionCode = e.getExceptionCode();
  +                if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
  +                {
  +                    throw;
  +                }
  +                else if (AXIS_SUCCESS == m_pCall->checkFault("Fault","http://localhost/axis/MathOps" ))//Exception handling code goes here
  +                {
  +                        cFaultcode = m_pCall->getElementAsString("faultcode", 0);
  +                        cFaultstring = m_pCall->getElementAsString("faultstring", 0);
  +                        cFaultactor = m_pCall->getElementAsString("faultactor", 0);
  +                   
  +                                  cFaultdetail = m_pCall->getElementAsString("faultdetail", 0);
  +                                  throw AxisException(cFaultdetail);
  +                      
  +                }
  +                else throw;
  +        }
  +        catch(...)
  +        {
  +            throw;
  +        }     
   	m_pCall->unInitialize();
   	return Ret;
   }