ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whitl...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal ClientStubWriter.java
Date Wed, 09 Mar 2005 14:49:39 GMT
whitlock    2005/03/09 06:49:38

  Modified:    c/include/axis/client Call.hpp
               c/src/engine/client Call.cpp
               c/src/soap SoapDeSerializer.cpp SoapDeSerializer.h
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubWriter.java
  Log:
  AXISCPP-523 Return a complex fault detail that is not defined in the WSDL as an XML string
  
  Revision  Changes    Path
  1.23      +5 -0      ws-axis/c/include/axis/client/Call.hpp
  
  Index: Call.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/Call.hpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Call.hpp	4 Mar 2005 20:57:38 -0000	1.22
  +++ Call.hpp	9 Mar 2005 14:49:05 -0000	1.23
  @@ -427,6 +427,11 @@
       AnyType* AXISCALL getAnyObject();
       int AXISCALL addAnyObject(AnyType* pAnyObject);
       const AxisChar* AXISCALL getNamespacePrefix(const AxisChar* pNamespace);
  +	
  +	/**
  +	 * Returns a complex fault as an XML string 
  +	 */
  +	const xsd__string getFaultAsXMLString();
   
   private:
       int openConnection();
  
  
  
  1.103     +6 -1      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.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- Call.cpp	4 Mar 2005 20:57:38 -0000	1.102
  +++ Call.cpp	9 Mar 2005 14:49:06 -0000	1.103
  @@ -835,4 +835,9 @@
           pAttribute = new Attribute((std::list<Attribute*>)NULL, pLocalname, pPrefix,
pValue);
       }
       m_pIWSSZ->setSOAPMethodAttribute(((Attribute*)pAttribute)->clone());
  -}
  \ No newline at end of file
  +}
  +
  +const xsd__string Call::getFaultAsXMLString()
  +{
  +	return m_pIWSDZ->getFaultAsXMLString();
  +}
  
  
  
  1.154     +68 -0     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.153
  retrieving revision 1.154
  diff -u -r1.153 -r1.154
  --- SoapDeSerializer.cpp	8 Mar 2005 17:50:13 -0000	1.153
  +++ SoapDeSerializer.cpp	9 Mar 2005 14:49:06 -0000	1.154
  @@ -3239,6 +3239,74 @@
       return ret;
   }
   
  +const xsd__string
  +SoapDeSerializer::getFaultAsXMLString()
  +{
  +    if (AXIS_SUCCESS != m_nStatus || RPC_ENCODED == m_nStyle) return NULL;
  +	if (!m_pNode) m_pNode = m_pParser->anyNext ();
  +	if (NULL==m_pNode) return NULL;
  +
  +	string xml;
  +	while (NULL!=m_pNode && !(0==strcmp("detail",m_pNode->m_pchNameOrValue) &&
END_ELEMENT==m_pNode->m_type))
  +	{
  +		string attrs;
  +		for (int i=0; i<MAX_NO_OF_ATTRIBUTES; i+=3)
  +		{
  +			const char *name = m_pNode->m_pchAttributes[i];
  +			const char *pfx = m_pNode->m_pchAttributes[i+1];
  +			const char *val = m_pNode->m_pchAttributes[i+2];
  +			if (NULL==name) break;
  +			if (0==i) attrs += " ";
  +
  +			if (NULL!=pfx)
  +			{
  +				attrs += pfx;
  +				attrs += ":";
  +			}
  +
  +			attrs += name;
  +			attrs += "=";
  +			if (NULL!=val) attrs += val;
  +			attrs += " ";
  +		}
  +
  +		switch (m_pNode->m_type)
  +		{
  +		case START_ELEMENT:
  +			xml += "<";
  +			xml += m_pNode->m_pchNameOrValue;
  +			if (attrs.size()>0) xml += attrs;
  +			if (END_ELEMENT==m_pNode->m_type2) xml += "/";
  +			xml += ">";
  +			break;
  +
  +		case END_ELEMENT:
  +			xml += "</";
  +			xml += m_pNode->m_pchNameOrValue;
  +			if (attrs.size()>0) xml += attrs;
  +			xml += ">";
  +			break;
  +
  +		case CHARACTER_ELEMENT:
  +			if (attrs.size()>0) xml += attrs;
  +			xml += m_pNode->m_pchNameOrValue;
  +			break;
  +
  +		case START_PREFIX:
  +		case END_PREFIX:
  +		default:
  +			break;
  +		}
  +
  +	    m_pNode = m_pParser->anyNext ();
  +	} // end while
  +
  +	if (0==xml.size()) return NULL;
  +	xsd__string ret = new char[xml.size()+1];
  +	strcpy(ret,xml.c_str());
  +	return ret;
  +}
  +
   xsd__anyURI
   SoapDeSerializer::getElementAsAnyURI (const AxisChar * pName,
   				      const AxisChar * pNamespace)
  
  
  
  1.39      +6 -0      ws-axis/c/src/soap/SoapDeSerializer.h
  
  Index: SoapDeSerializer.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.h,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- SoapDeSerializer.h	4 Mar 2005 17:03:11 -0000	1.38
  +++ SoapDeSerializer.h	9 Mar 2005 14:49:14 -0000	1.39
  @@ -245,6 +245,12 @@
         *Returns the attachemtn object for the given id.
         */
       ISoapAttachment* getAttachment(const char* pcAttachmentid);
  +
  +	/**
  +	 * Returns a complex fault as an XML string 
  +	 */
  +	const xsd__string getFaultAsXMLString();
  +
       /*
        *This class is used by the DeSerializer to set the input stream back to 
        * the parser in following situations:
  
  
  
  1.78      +33 -6     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- ClientStubWriter.java	7 Mar 2005 15:29:19 -0000	1.77
  +++ ClientStubWriter.java	9 Mar 2005 14:49:38 -0000	1.78
  @@ -1046,9 +1046,23 @@
           int j = 0;
           if (!paramsFault.hasNext())
           {
  -            writer.write("\t\t\tthrow OtherFaultException(pSoapFault->getFaultcode(),\n");
  -            writer.write("\t\t\t\tpSoapFault->getFaultstring(), pSoapFault->getFaultactor(),\n");
  -		writer.write("\t\t\t\tpSoapFault->getSimpleFaultDetail(), iExceptionCode);\n");
  +            writer.write("\t\t\t\tconst char *detail = pSoapFault->getSimpleFaultDetail();\n");
  +            writer.write("\t\t\t\tbool deleteDetail=false;\n");
  +            writer.write("\t\t\t\tif (NULL==detail || 0==strlen(detail))\n");
  +            writer.write("\t\t\t\t{\n");
  +            writer.write("\t\t\t\t\tdetail=m_pCall->getFaultAsXMLString();\n");
  +            writer.write("\t\t\t\t\tif (NULL==detail)\n");
  +            writer.write("\t\t\t\t\t\tdetail=\"\";\n");
  +            writer.write("\t\t\t\t\telse\n");
  +            writer.write("\t\t\t\t\t\tdeleteDetail=true;\n");
  +            writer.write("\t\t\t\t}\n");
  +            writer.write("\t\t\t\tOtherFaultException ofe(pSoapFault->getFaultcode(),\n");
  +            writer.write("\t\t\t\t\tpSoapFault->getFaultstring(), pSoapFault->getFaultactor(),\n");
  +		writer.write("\t\t\t\t\tdetail, iExceptionCode);\n");
  +            writer.write("\t\t\t\tif (deleteDetail && NULL!=detail)\n");
  +            writer.write("\t\t\t\t\tdelete [] const_cast<char*>(detail);\n");
  +            writer.write("\t\t\t\tm_pCall->unInitialize();\n");
  +            writer.write("\t\t\t\tthrow ofe;\n");
           }
           else
           {
  @@ -1120,10 +1134,23 @@
           {
               writer.write("\t\t\telse\n");
               writer.write("\t\t\t{\n");
  +            writer.write("\t\t\t\tconst char *detail = pSoapFault->getSimpleFaultDetail();\n");
  +            writer.write("\t\t\t\tbool deleteDetail=false;\n");
  +            writer.write("\t\t\t\tif (NULL==detail || 0==strlen(detail))\n");
  +            writer.write("\t\t\t\t{\n");
  +            writer.write("\t\t\t\t\tdetail=m_pCall->getFaultAsXMLString();\n");
  +            writer.write("\t\t\t\t\tif (NULL==detail)\n");
  +            writer.write("\t\t\t\t\t\tdetail=\"\";\n");
  +            writer.write("\t\t\t\t\telse\n");
  +            writer.write("\t\t\t\t\t\tdeleteDetail=true;\n");
  +            writer.write("\t\t\t\t}\n");
  +            writer.write("\t\t\t\tOtherFaultException ofe(pSoapFault->getFaultcode(),\n");
  +            writer.write("\t\t\t\t\tpSoapFault->getFaultstring(), pSoapFault->getFaultactor(),\n");
  +		writer.write("\t\t\t\t\tdetail, iExceptionCode);\n");
  +            writer.write("\t\t\t\tif (deleteDetail && NULL!=detail)\n");
  +            writer.write("\t\t\t\t\tdelete [] const_cast<char*>(detail);\n");
               writer.write("\t\t\t\tm_pCall->unInitialize();\n");
  -            writer.write("\t\t\tthrow OtherFaultException(pSoapFault->getFaultcode(),\n");
  -            writer.write("\t\t\t\tpSoapFault->getFaultstring(), pSoapFault->getFaultactor(),\n");
  -		writer.write("\t\t\t\tpSoapFault->getSimpleFaultDetail(), iExceptionCode);\n");
  +            writer.write("\t\t\t\tthrow ofe;\n");
               writer.write("\t\t\t}\n");
           }
           writer.write("\t\t}\n");
  
  
  

Mime
View raw message