Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

AxisException.h

00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
00015  *
00016  *
00017  *   @author Damitha Kumarage (damitha@opensource.lk, damitha@jkcsworld.com)
00018  *
00019  */
00020  
00021 #ifndef __AXISEXCEPTION_H_OF_AXIS_INCLUDED_
00022 #define __AXISEXCEPTION_H_OF_AXIS_INCLUDED_
00023 
00024 #include <string>
00025 #include <exception>
00026 #include <new>
00027 #include <typeinfo>
00028 #include <stdexcept>
00029 //#include <ios>
00030 using namespace std;
00031 
00032 
00033 #ifdef ENABLE_AXIS_EXCEPTION
00034 #define AXISC_TRY try {
00035 #define AXISC_CATCH(X) } catch (X) { 
00036 #define AXISC_ENDCATCH }
00037 
00038 #define THROW_AXIS_EXCEPTION(X) throw AxisException(X)
00039 #define THROW_AXIS_CONFIG_EXCEPTION(X) throw AxisConfigException(X)
00040 #define THROW_AXIS_SOAP_EXCEPTION(X) throw AxisSoapException(X)
00041 #define THROW_AXIS_WSDD_EXCEPTION(X) throw AxisWsddException(X)
00042 #define THROW_AXIS_ENGINE_EXCEPTION(X) throw AxisEngineException(X)
00043 #define THROW_AXIS_TRANSPORT_EXCEPTION(X) throw AxisTransportException(X)
00044 #define THROW_AXIS_PARSE_EXCEPTION(X) throw AxisParseException(X)
00045 
00046 #define THROW_AXIS_BAD_ALLOC() throw std::bad_alloc
00047 #define THROW_AXIS_BAD_CAST() throw std::bad_cast
00048 #define THROW_AXIS_BAD_TYPEID() throw std::bad_typeid
00049 #define THROW_AXIS_BAD_EXCEPTION() throw std::bad_exception
00050 #define THROW_AXIS_OUT_OF_RANGE(X) throw std::out_of_range
00051 #define THROW_AXIS_INVALID_ARGUMENT(X) throw std::invalid_argument
00052 #define THROW_AXIS_OVERFLOW_ERROR(X) throw std::overflow_error
00053 //#define THROW_AXIS_IOS_BASE_FAILURE(X) throw std::ios_base::failure
00054 
00055 #define AXISC_THROW_SAME throw
00056 
00057 #else
00058 
00059 #define AXISC_TRY 
00060 #define AXISC_CATCH(X) 
00061 #define AXISC_ENDCATCH
00062 
00063 #define THROW_AXIS_EXCEPTION(X) return X
00064 #define THROW_AXIS_CONFIG_EXCEPTION(X) return X
00065 #define THROW_AXIS_SOAP_EXCEPTION(X) return X
00066 #define THROW_AXIS_WSDD_EXCEPTION(X) return X
00067 #define THROW_AXIS_ENGINE_EXCEPTION(X) return X
00068 #define THROW_AXIS_TRANSPORT_EXCEPTION(X) return X
00069 #define THROW_AXIS_PARSE_EXCEPTION(X) return X
00070 
00071 #define THROW_AXIS_BAD_ALLOC()
00072 #define THROW_AXIS_BAD_CAST()
00073 #define THROW_AXIS_BAD_TYPEID()
00074 #define THROW_AXIS_BAD_EXCEPTION()
00075 #define THROW_AXIS_OUT_OF_RANGE(X)
00076 #define THROW_AXIS_INVALID_ARGUMENT(X)
00077 #define THROW_AXIS_OVERFLOW_ERROR(X)
00078 #define THROW_AXIS_IOS_BASE_FAILURE(X)
00079 
00080 #define AXISC_THROW_SAME 
00081 #endif
00082 
00083 /*
00084  * The following enumeration is used to serve the Axis C++ codes for 
00085  * faults.
00086  */
00087 enum AXISC_EXCEPTIONS 
00088 {
00089     /* VersionMismatch faults */
00090     SOAP_VERSION_MISMATCH,
00091     
00092     /* MustUnderstand faults */
00093     SOAP_MUST_UNDERSTAND,
00094 
00095     /*The notation used for naming these exceptions is as follows
00096      *CLIENT at the beginning means when this interpreted as a soap fault
00097      *    it's fault code is CLIENT
00098      *SERVER at the beginning means when this interpreted as a soap fault
00099      *    it's fault code is SERVER
00100      *SOAP that comes next to CLIENT/SERVER means this is a soap releated
00101      *    exception
00102      *ENGINE that comes next to CLIENT/SERVER means this is a axisc++ engine
00103      *    related exception
00104      *WSDD that comes next to CLIENT/SERVER means this is a wsdd releated
00105      *    exception
00106      *TRANSPORT that comes next to CLIENT/SERVER means this is a transport releated
00107      *    exception
00108      *CONFIG that comes next to CLIENT/SERVER means this is a axisc++ configuration
00109      *    related exception
00110      */
00111      
00112     /* Client faults */
00113     CLIENT_SOAP_MESSAGE_INCOMPLETE,
00114     CLIENT_SOAP_SOAP_ACTION_EMTPY,
00115     CLIENT_SOAP_SOAP_CONTENT_ERROR,
00116     CLIENT_SOAP_NO_SOAP_METHOD,
00117     CLIENT_SOAP_CONTENT_NOT_SOAP,
00118     CLIENT_WSDD_SERVICE_NOT_FOUND,
00119     CLIENT_WSDD_METHOD_NOT_ALLOWED,
00120     CLIENT_WSDD_PARA_TYPE_MISMATCH,
00121     CLIENT_ENGINE_CLIENT_HANDLER_FAILED,
00122 
00123     /* Server faults */
00124     SERVER_ENGINE_EXCEPTION,
00125     SERVER_ENGINE_COULD_NOT_LOAD_SRV,
00126     SERVER_ENGINE_COULD_NOT_LOAD_HDL,
00127     SERVER_ENGINE_HANDLER_FAILED,
00128     SERVER_ENGINE_WEBSERVICE_FAILED,
00129     SERVER_ENGINE_HANDLER_INIT_FAILED,
00130     SERVER_ENGINE_HANDLER_CREATION_FAILED,
00131     SERVER_ENGINE_LIBRARY_LOADING_FAILED,
00132     SERVER_ENGINE_HANDLER_NOT_LOADED,
00133     SERVER_ENGINE_HANDLER_BEING_USED,
00134     SERVER_ENGINE_GET_HANDLER_FAILED,
00135     SERVER_ENGINE_WRONG_HANDLER_TYPE,
00136     SERVER_CONFIG_EXCEPTION,
00137     SERVER_CONFIG_TRANSPORT_CONF_FAILED,
00138     SERVER_CONFIG_LIBRARY_PATH_EMPTY,
00139     SERVER_WSDD_EXCEPTION,
00140     SERVER_WSDD_NO_HANDLERS_CONFIGURED,
00141     SERVER_SOAP_EXCEPTION,
00142     SERVER_TRANSPORT_EXCEPTION,
00143     SERVER_TRANSPORT_RECEPTION_EXCEPTION,
00144     SERVER_TRANSPORT_SENDING_EXCEPTION,
00145     SERVER_TRANSPORT_PROCESS_EXCEPTION,
00146     SERVER_TRANSPORT_UNKNOWN_HTTP_RESPONSE,
00147     SERVER_TRANSPORT_HTTP_EXCEPTION,
00148     SERVER_TRANSPORT_UNEXPECTED_STRING,
00149     SERVER_TRANSPORT_CHANNEL_INIT_ERROR,
00150     SERVER_TRANSPORT_SOCKET_CREATE_ERROR,
00151     SERVER_TRANSPORT_SOCKET_CONNECT_ERROR,
00152     SERVER_TRANSPORT_INVALID_SOCKET,
00153     SERVER_TRANSPORT_OUTPUT_STREAMING_ERROR,
00154     SERVER_TRANSPORT_INPUT_STREAMING_ERROR,
00155     SERVER_TRANSPORT_TIMEOUT_EXCEPTION,
00156     SERVER_TRANSPORT_TIMEOUT_EXPIRED,
00157     SERVER_TRANSPORT_BUFFER_EMPTY,
00158     SERVER_PARSE_BUFFER_EMPTY,
00159     SERVER_PARSE_PARSER_FAILED, 
00160  
00161     SERVER_TEST_EXCEPTION,
00162     SERVER_UNKNOWN_ERROR,
00163     /*Following exceptions are not releated to soap faults
00164      */
00165     AXISC_SERVICE_THROWN_EXCEPTION,
00166     AXISC_UNKNOWN_ELEMENT_EXCEPTION,
00167     AXISC_NODE_VALUE_MISMATCH_EXCEPTION,
00168     AXISC_READ_CONF_EXCEPTION,
00169 
00170     /*
00171      * This FAULT_LAST is not used as a fault code, but instead is used 
00172      * internaly in the code. Developers should not use this as a fault 
00173      * code.
00174      */
00175     FAULT_LAST 
00176 };
00177 
00189 class AxisException :public exception
00190 {
00191 
00192 public:
00194     AxisException(){};
00195 
00205     AxisException(int iExceptionCode);
00206 
00215     AxisException(exception* e);
00216 
00223     AxisException(exception* e, int iExceptionCode);
00224     
00229     AxisException(char* pcMessage){m_sMessage = pcMessage;};
00230     
00232     virtual ~AxisException() throw();
00233 
00237     virtual const char* what() throw();
00238 
00248     virtual const int getExceptionCode();
00249     virtual const string getMessage(exception* e);
00250     virtual const string getMessage(int iExceptionCode);    
00251 
00252 private:
00253     void processException(exception* e);
00254     void processException(exception* e, int iExceptionCode);
00255     void processException(int iExceptionCode);
00256     string m_sMessage; //Holds the exception messae
00257     int m_iExceptionCode; //Holds the exception code
00258 };
00259 
00260 #endif
00261 

Generated on Tue Jun 15 19:13:22 2004 for axiscpp by doxygen1.2.18