axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp SoapSerializer.cpp
Date Mon, 31 May 2004 03:47:49 GMT
damitha     2004/05/30 20:47:49

  Modified:    c/samples/client/doclitfault MathOps.cpp
               c/samples/client/rpcfault MathOps.cpp
               c/samples/server/doclitfault DivByZeroFault.cpp
                        MathOpsWrapper.cpp
               c/src/soap SoapDeSerializer.cpp SoapSerializer.cpp
  Log:
  In the process of exception handling and fault mapping
  
  Revision  Changes    Path
  1.4       +21 -18    ws-axis/c/samples/client/doclitfault/MathOps.cpp
  
  Index: MathOps.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/doclitfault/MathOps.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MathOps.cpp	28 May 2004 03:20:40 -0000	1.3
  +++ MathOps.cpp	31 May 2004 03:47:49 -0000	1.4
  @@ -53,7 +53,7 @@
   	{
   		if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://soapinterop.org/wsdl"))
   		{
  -			Ret = m_pCall->getElementAsInt("addReturn", 0);
  +			Ret = m_pCall->getElementAsInt("divReturn", 0);
   		}
   	}
       }
  @@ -65,29 +65,32 @@
               cFaultcode = m_pCall->getElementAsString("faultcode", 0);
               cFaultstring = m_pCall->getElementAsString("faultstring", 0);
               cFaultactor = m_pCall->getElementAsString("faultactor", 0);
  -            if(AXIS_SUCCESS == m_pCall->checkFault("faultdetail",
  -                "http://localhost/axis/MathOps/types"))
  +            if(0 != strcmp("service_exception", cFaultstring))
               {
  -                m_pCall->getFaultDetail(&cFaultdetail);
  +                cFaultdetail = m_pCall->getElementAsString("faultdetail", 0);
                   throw AxisException(cFaultdetail);
               }
               else
               {
  -                DivByZeroFault* pFaultDetail = NULL;
  -                pFaultDetail = (DivByZeroFault*)m_pCall->
  -                    getCmplxObject((void*) Axis_DeSerialize_DivByZeroFault,
  -                    (void*) Axis_Create_DivByZeroFault,
  -                    (void*) Axis_Delete_DivByZeroFault,"faultstruct", 0);
  +                if(AXIS_SUCCESS == m_pCall->checkFault("faultdetail",
  +                    "http://localhost/axis/MathOps/types"))
  +                {
  +                    DivByZeroFault* pFaultDetail = NULL;
  +                    pFaultDetail = (DivByZeroFault*)m_pCall->
  +                        getCmplxObject((void*) Axis_DeSerialize_DivByZeroFault,
  +                        (void*) Axis_Create_DivByZeroFault,
  +                        (void*) Axis_Delete_DivByZeroFault,"DivByZeroException", 0);
                                                                                         
                                                      
  -                char* temp = pFaultDetail->varString;
  -                printf("%s\n", temp);
  -                /*start user code*/
  -                printf("faultcode:%s\n", cFaultcode);
  -                printf("faultstring:%s\n", cFaultstring);
  -                printf("faultactor:%s\n", cFaultactor);
  -                /*end user code*/
  -                m_pCall->unInitialize();
  -                throw AxisDivByZeroException(pFaultDetail);
  +                    char* temp = pFaultDetail->varString;
  +                    printf("%s\n", temp);
  +                    /*start user code*/
  +                    printf("faultcode:%s\n", cFaultcode);
  +                    printf("faultstring:%s\n", cFaultstring);
  +                    printf("faultactor:%s\n", cFaultactor);
  +                    /*end user code*/
  +                    m_pCall->unInitialize();
  +                    throw AxisDivByZeroException(pFaultDetail);
  +                }
               }
           }
           else throw;
  
  
  
  1.8       +19 -16    ws-axis/c/samples/client/rpcfault/MathOps.cpp
  
  Index: MathOps.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/MathOps.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MathOps.cpp	26 May 2004 06:27:16 -0000	1.7
  +++ MathOps.cpp	31 May 2004 03:47:49 -0000	1.8
  @@ -74,29 +74,32 @@
               cFaultcode = m_pCall->getElementAsString("faultcode", 0);
               cFaultstring = m_pCall->getElementAsString("faultstring", 0); 
               cFaultactor = m_pCall->getElementAsString("faultactor", 0);
  -            if(AXIS_SUCCESS == m_pCall->checkFault("faultdetail",
  -                "http://localhost/axis/MathOps"))
  +            if(0 != strcmp("service_exception", cFaultstring))
               {
  -                m_pCall->getFaultDetail(&cFaultdetail);
  +                cFaultdetail = m_pCall->getElementAsString("faultdetail", 0);
                   throw AxisException(cFaultdetail);
               }
               else
               {
  -                SOAPStructFault* pFaultDetail = NULL;
  -                pFaultDetail = (SOAPStructFault*)m_pCall->
  +                if(AXIS_SUCCESS == m_pCall->checkFault("faultdetail",
  +                    "http://localhost/axis/MathOps"))
  +                {
  +                    SOAPStructFault* pFaultDetail = NULL;
  +                    pFaultDetail = (SOAPStructFault*)m_pCall->
                       getCmplxObject((void*) Axis_DeSerialize_SOAPStructFault, 
  -                    (void*) Axis_Create_SOAPStructFault, 
  -                    (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
  +                        (void*) Axis_Create_SOAPStructFault, 
  +                        (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
   
  -                char* temp = pFaultDetail->varString;
  -                printf("%s\n", temp);
  -                /*start user code*/
  -                printf("faultcode:%s\n", cFaultcode);
  -                printf("faultstring:%s\n", cFaultstring);
  -                printf("faultactor:%s\n", cFaultactor);
  -                /*end user code*/
  -                m_pCall->unInitialize();
  -                throw AxisDivByZeroException(pFaultDetail);
  +                    char* temp = pFaultDetail->varString;
  +                    printf("%s\n", temp);
  +                    /*start user code*/
  +                    printf("faultcode:%s\n", cFaultcode);
  +                    printf("faultstring:%s\n", cFaultstring);
  +                    printf("faultactor:%s\n", cFaultactor);
  +                    /*end user code*/
  +                    m_pCall->unInitialize();
  +                    throw AxisDivByZeroException(pFaultDetail);
  +                }
               }
           }
           else throw;
  
  
  
  1.3       +3 -13     ws-axis/c/samples/server/doclitfault/DivByZeroFault.cpp
  
  Index: DivByZeroFault.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/DivByZeroFault.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DivByZeroFault.cpp	27 May 2004 11:50:41 -0000	1.2
  +++ DivByZeroFault.cpp	31 May 2004 03:47:49 -0000	1.3
  @@ -13,23 +13,13 @@
    */
   int Axis_Serialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapSerializer* pSZ, bool
bArray = false)
   {
  -	if (bArray)
  -	{
  -		pSZ->serialize("<", Axis_TypeName_DivByZeroFault, ">", NULL);
  -	}
  -	else
  -	{
  -		const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_DivByZeroFault);
  -		pSZ->serialize("<", Axis_TypeName_DivByZeroFault, " xsi:type=\"", sPrefix, ":",
  -			Axis_TypeName_DivByZeroFault, "\" xmlns:", sPrefix, "=\"",
  -			Axis_URI_DivByZeroFault, "\">", NULL);
  -	}
  -
  +        /* first serialize attributes if any*/
  +        pSZ->serialize(">", 0);
  +        /* then serialize elements if any*/
   	pSZ->serializeAsElement("varString", (void*)&(param->varString), XSD_STRING);
   	pSZ->serializeAsElement("varInt", (void*)&(param->varInt), XSD_INT);
   	pSZ->serializeAsElement("varFloat", (void*)&(param->varFloat), XSD_FLOAT);
   
  -	pSZ->serialize("</", Axis_TypeName_DivByZeroFault, ">", NULL);
   	return AXIS_SUCCESS;
   }
   
  
  
  
  1.4       +1 -2      ws-axis/c/samples/server/doclitfault/MathOpsWrapper.cpp
  
  Index: MathOpsWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOpsWrapper.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MathOpsWrapper.cpp	28 May 2004 03:19:35 -0000	1.3
  +++ MathOpsWrapper.cpp	31 May 2004 03:47:49 -0000	1.4
  @@ -87,8 +87,7 @@
   
               if(pObjFault)
                   pIWSSZ->addFaultDetail(pObjFault, (void*)Axis_Serialize_DivByZeroFault,
  -                    (void*)Axis_Delete_DivByZeroFault, "DivByZeroException",
  -                    Axis_URI_DivByZeroFault);
  +                    (void*)Axis_Delete_DivByZeroFault, "DivByZeroException", "");
   
               throw;
           }
  
  
  
  1.54      +13 -11    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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- SoapDeSerializer.cpp	26 May 2004 07:23:49 -0000	1.53
  +++ SoapDeSerializer.cpp	31 May 2004 03:47:49 -0000	1.54
  @@ -321,17 +321,10 @@
        }
        else
        {
  -         char* tempChar = getElementAsString("faultdetail", 0);
  -         if(0 == tempChar)
  -         {
  -             m_nStatus = AXIS_SUCCESS;
  -             return AXIS_FAIL;
  -         }
  -         else
  -         {
  -             m_pcFaultDetail = tempChar;
  -             return AXIS_SUCCESS;
  -         }
  +         //skip faultdetail
  +         m_pParser->next();
  +         m_nStatus = AXIS_SUCCESS;
  +         return AXIS_SUCCESS;
           
        }
    
  @@ -1380,18 +1373,25 @@
       }
       else
       {
  +        AXISTRACE1("came1", INFO);
           if (!m_pNode)
  +        AXISTRACE1("came1", INFO);
               /* if there is an unprocessed node that may be one left from last 
                * array deserialization
                */
               m_pNode = m_pParser->next();
               /* wrapper node without type info  Ex: <i> */
           if (!m_pNode) return ret;
  +        AXISTRACE1("came2", INFO);
  +        AXISTRACE2("pName", pName,INFO);
  +        AXISTRACE2("pName", m_pNode->m_pchNameOrValue,INFO);
           if (0 == strcmp(pName, m_pNode->m_pchNameOrValue))
           {
  +        AXISTRACE1("came3", INFO);
               m_pNode = m_pParser->next(true); /* charactor node */
               if (m_pNode && (CHARACTER_ELEMENT == m_pNode->m_type))
               {
  +        AXISTRACE1("came4", INFO);
                   ret = strtol(m_pNode->m_pchNameOrValue, &m_pEndptr, 10);
                   m_pNode = m_pParser->next(); /* skip end element node too */
                   m_pNode = NULL;
  @@ -1403,6 +1403,7 @@
               }
               else
               {
  +        AXISTRACE1("came5", INFO);
                   /* simpleType may have xsi:nill="true" */
                   m_pNode = NULL;
                   /* this is important in doc/lit style when deserializing 
  @@ -1413,6 +1414,7 @@
           }
           else
           {
  +        AXISTRACE1("came6", INFO);
               return ret;
               /* Not a must : m_nStatus = AXIS_FAIL; unexpected SOAP stream */
           }
  
  
  
  1.50      +1 -1      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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- SoapSerializer.cpp	26 May 2004 06:27:16 -0000	1.49
  +++ SoapSerializer.cpp	31 May 2004 03:47:49 -0000	1.50
  @@ -451,7 +451,7 @@
       pSoapFault->setPrefix(getNamespacePrefix(sURI));
       pSoapFault->setUri(sURI);
       pSoapFault->setFaultcode("Server");
  -    pSoapFault->setFaultstring("Service thrown exception");
  +    pSoapFault->setFaultstring("service_exception");
       pSoapFault->setFaultactor("http://endpoint/url");
       
       return AXIS_SUCCESS;
  
  
  

Mime
View raw message