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 wh...@apache.org on 2005/02/23 16:12:06 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal ClientStubHeaderWriter.java ClientStubWriter.java

whitlock    2005/02/23 07:12:06

  Modified:    c/include/axis SoapFaultException.hpp
               c/src/soap Makefile.am SoapFaultException.cpp
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubHeaderWriter.java ClientStubWriter.java
  Added:       c/include/axis OtherFaultException.hpp
               c/src/soap OtherFaultException.cpp
  Log:
  AXISCPP-463 When the server throws a fault (not a user-defined fault in the wsdl), throw back an exception to the client application with the correct information in it. This fix adds in OtherFaultException which encapsulates other soap faults generated by the server. OtherFaultException extends SoapFaultException and is thrown back to the client application.
  
  Revision  Changes    Path
  1.3       +1 -1      ws-axis/c/include/axis/SoapFaultException.hpp
  
  Index: SoapFaultException.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/SoapFaultException.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SoapFaultException.hpp	15 Feb 2005 14:56:16 -0000	1.2
  +++ SoapFaultException.hpp	23 Feb 2005 15:12:06 -0000	1.3
  @@ -42,7 +42,7 @@
   {
   public:
   	SoapFaultException();
  -	SoapFaultException(AxisChar *code, AxisChar *string, AxisChar *actor, int exceptionCode);
  +	SoapFaultException(const AxisChar *code, const AxisChar *string, const AxisChar *actor, int exceptionCode);
   	SoapFaultException(AxisException& ae);
   	virtual ~SoapFaultException() throw();
   
  
  
  
  1.1                  ws-axis/c/include/axis/OtherFaultException.hpp
  
  Index: OtherFaultException.hpp
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
   
  #ifndef __OTHERFAULTEXCEPTION_H_OF_AXIS_INCLUDED_
  #define __OTHERFAULTEXCEPTION_H_OF_AXIS_INCLUDED_
  
  #include <axis/GDefine.hpp>
  #include <axis/SoapFaultException.hpp>
  
  AXIS_CPP_NAMESPACE_START
  
  /**
   * @class OtherFaultException
   * @brief
   * 
   * @author Mark Whitlock
   */
  
  class STORAGE_CLASS_INFO OtherFaultException : public SoapFaultException
  {
  public:
  	OtherFaultException();
  	OtherFaultException(const AxisChar *code, const AxisChar *string, 
  		const AxisChar *actor, const AxisChar *detail, int exceptionCode);
  	OtherFaultException(AxisException& ae);
  	virtual ~OtherFaultException() throw();
  
  	virtual const AxisChar *getFaultDetail() const;
  	virtual void setFaultDetail(const AxisChar *detail);
  private:
  	AxisChar *m_detail;
  };
  
  AXIS_CPP_NAMESPACE_END
  
  #endif
  
  
  
  
  1.38      +1 -0      ws-axis/c/src/soap/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/Makefile.am,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Makefile.am	18 Feb 2005 14:23:03 -0000	1.37
  +++ Makefile.am	23 Feb 2005 15:12:06 -0000	1.38
  @@ -22,6 +22,7 @@
           SoapAttachment.cpp \
           SoapAttachementHeaders.cpp \
           SoapFaultException.cpp \
  +        OtherFaultException.cpp \
           xsd/Int.cpp \
           xsd/Integer.cpp \
           xsd/Long.cpp \
  
  
  
  1.3       +1 -1      ws-axis/c/src/soap/SoapFaultException.cpp
  
  Index: SoapFaultException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapFaultException.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SoapFaultException.cpp	15 Feb 2005 14:56:16 -0000	1.2
  +++ SoapFaultException.cpp	23 Feb 2005 15:12:06 -0000	1.3
  @@ -41,7 +41,7 @@
   }
   
   SoapFaultException::SoapFaultException(
  -	AxisChar *code, AxisChar *string, AxisChar *actor, int exceptionCode)
  +	const AxisChar *code, const AxisChar *string, const AxisChar *actor, int exceptionCode)
   {
   	STRINGCOPY(m_code,code);
   	STRINGCOPY(m_string,string);
  
  
  
  1.1                  ws-axis/c/src/soap/OtherFaultException.cpp
  
  Index: OtherFaultException.cpp
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
   
  #include <axis/OtherFaultException.hpp>
  
  AXIS_CPP_NAMESPACE_START
  
  /*
   * All the methods in this class do a deep copy of the data so that the fault can be
   * processed whatever state the engine is in. Doing a deep copy means this class owns
   * the storage and can delete it in its destructor making client programming simpler.
   */
  #define STRINGCOPY(tgt,src)					\
  {											\
  	if (NULL != src && 0 != strlen(src))	\
  	{										\
  		tgt = new AxisChar[strlen(src)+1];	\
  		strcpy(tgt, src);					\
  	} else tgt = NULL;						\
  }
  
  OtherFaultException::OtherFaultException() 
  {
  	m_detail = NULL;
  }
  
  OtherFaultException::OtherFaultException(
  	const AxisChar *code, const AxisChar *string, const AxisChar *actor, const AxisChar *detail, int exceptionCode) :
  	SoapFaultException(code,string,actor,exceptionCode)
  {
  	STRINGCOPY(m_detail,detail);
  }
  
  OtherFaultException::OtherFaultException(AxisException& ae) : SoapFaultException(ae)
  {
  	m_detail = NULL;
  }
  
  OtherFaultException::~OtherFaultException() throw()
  {
  	if (NULL != m_detail) delete [] m_detail;
  	m_detail = NULL;
  }
  
  const AxisChar *OtherFaultException::getFaultDetail() const
  {
  	return m_detail;
  }
  
  void OtherFaultException::setFaultDetail(const AxisChar *detail)
  {
  	STRINGCOPY(m_detail,detail);
  }
  
  AXIS_CPP_NAMESPACE_END
  
  
  
  
  1.32      +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ClientStubHeaderWriter.java	18 Feb 2005 11:11:21 -0000	1.31
  +++ ClientStubHeaderWriter.java	23 Feb 2005 15:12:06 -0000	1.32
  @@ -199,7 +199,7 @@
           try
           {
               writer.write("#include <axis/client/Stub.hpp>\n");
  -            writer.write("#include <axis/SoapFaultException.hpp>\n");
  +            writer.write("#include <axis/OtherFaultException.hpp>\n");
               writer.write("#include <axis/ISoapFault.hpp>\n");
               writer.write("AXIS_CPP_NAMESPACE_USE\n");
               Type atype;
  
  
  
  1.71      +3 -1      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.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- ClientStubWriter.java	22 Feb 2005 16:51:41 -0000	1.70
  +++ ClientStubWriter.java	23 Feb 2005 15:12:06 -0000	1.71
  @@ -1025,7 +1025,9 @@
           int j = 0;
           if (!paramsFault.hasNext())
           {
  -            writer.write("\t\t\tthrow;\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");
           }
           else
           {