Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

IWrapperSoapSerializer.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 #if !defined(_IWRAPPERSOAPSERIALIZER_H____OF_AXIS_INCLUDED_)
00018 #define _IWRAPPERSOAPSERIALIZER_H____OF_AXIS_INCLUDED_
00019 
00020 #include "AxisUserAPI.h"
00021 #ifdef __cplusplus
00022 #include "TypeMapping.h"
00023 #include "ISoapSerializer.h"
00024 #include "WSDDDefines.h"
00025 
00026 #endif
00027 
00028 typedef struct 
00029 {
00030     int (AXISCALL* createSoapMethod)(void* pObj, const AxisChar* sLocalName, 
00031         const AxisChar* sURI);
00032 
00033     int (AXISCALL* createSoapFault)(void* pObj, const AxisChar* sLocalName, 
00034         const AxisChar* sURI, const AxisChar* sFaultCode,
00035         const AxisChar* sFaultString);
00036 
00037     const AxisChar* (AXISCALL* getNamespacePrefix)(void* pObj, 
00038         const AxisChar* pNamespace);
00039 
00040     void (AXISCALL* removeNamespacePrefix)(void* pObj, 
00041         const AxisChar* pNamespace);
00042 
00043     /* for basic types */
00044     int (AXISCALL* addOutputParam)(void* pObj, const AxisChar* pchName, 
00045         void* pValue, XSDTYPE type);
00046 
00047     /* for arrays */
00048     int (AXISCALL* addOutputCmplxArrayParam)(void* pObj, 
00049         const Axis_Array* pArray, void* pSZFunct, void* pDelFunct, 
00050         void* pSizeFunct, const AxisChar* pName, const AxisChar* pNamespace);
00051 
00052     int (AXISCALL* addOutputBasicArrayParam)(void* pObj, 
00053         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName);
00054 
00055     /* for complex types */
00056     int (AXISCALL* addOutputCmplxParam)(void* pObj, void* pObject, 
00057         void* pSZFunct, void* pDelFunct, const AxisChar* pName, 
00058         const AxisChar* pNamespace);
00059 
00060     int (AXISCALL* addFaultDetail)(void* pObj, void* pObject, void* pSZFunct,
00061         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace );
00062 
00063     /* Methods used to serialize arrays */
00064     int (AXISCALL* serializeCmplxArray)(void* pObj, const Axis_Array* pArray, 
00065         void* pSZFunct, void* pDelFunct, void* pSizeFunct, 
00066         const AxisChar* pName, const AxisChar* pNamespace);
00067 
00068     int (AXISCALL* serializeBasicArray)(void* pObj, 
00069         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName);
00070 
00071     /* Basic Type Serializing methods */
00072     int (AXISCALL* serializeAsElement)(void* pObj, const AxisChar* sName, 
00073         void* pValue, XSDTYPE type);
00074 
00075     int (AXISCALL* serializeAsAttribute)(void* pObj, const AxisChar* sName, 
00076         const AxisChar* pNamespace, void* pValue, XSDTYPE type);
00077 
00078     void (AXISCALL* serialize)(void* pObj, const char* pFirst);
00079 
00080     void (AXISCALL* serializeStartElementOfType)(void* pObj, 
00081         const AxisChar* pName, const AxisChar* pNamespace, 
00082         const AxisChar* pPrefix);
00083 
00084     void (AXISCALL* serializeEndElementOfType)(void* pObj, 
00085         const AxisChar* pName);
00086 
00087     int (AXISCALL* addOutputAnyObject)(void* pObj, AnyType* pAnyObject);
00088 
00089     int (AXISCALL* serializeAnyObject)(void* pObj, AnyType* pAnyObject);    
00090 }IWrapperSoapSerializerFunctions;
00091 
00092 typedef struct 
00093 { 
00094     void* _object; /* this will be C++ SoapSerializer Object */
00095     IWrapperSoapSerializerFunctions* _functions; 
00096     /* this is the static function table */
00097 } IWrapperSoapSerializer_C;
00098 
00099 #ifndef __cplusplus
00100 typedef IWrapperSoapSerializer_C IWrapperSoapSerializer;
00101 #else
00102 /*
00103  *  @class IWrapperSoapSerializer
00104  *  @brief interface for the IWrapperSoapSerializer class.
00105  *
00106  *
00107  *  @author Susantha Kumara (skumara@virtusa.com, susantha@opensource.lk)
00108  *  @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
00109  *
00110  */
00111 
00112 AXIS_CPP_NAMESPACE_START
00113 
00114 class IWrapperSoapSerializer : public ISoapSerializer
00115 {
00116 public:
00117     virtual ~IWrapperSoapSerializer(){};
00118 
00119     virtual int AXISCALL createSoapMethod(const AxisChar* sLocalName, 
00120         const AxisChar* sURI)=0;
00121 
00122     virtual int AXISCALL createSoapFault(const AxisChar* sLocalName, 
00123         const AxisChar* sURI, const AxisChar* sFaultCode,
00124         const AxisChar* sFaultString)=0;
00125 
00126     virtual const AxisChar* AXISCALL getNamespacePrefix
00127         (const AxisChar* pNamespace)=0;
00128 
00129     virtual void AXISCALL removeNamespacePrefix(const AxisChar* pNamespace)=0;
00130 
00131     /* for basic types */
00132     virtual int AXISCALL addOutputParam(const AxisChar* pchName, void* pValue, 
00133         XSDTYPE type)=0;
00134 
00135     /* for arrays */
00136     virtual int AXISCALL addOutputCmplxArrayParam(const Axis_Array* pArray, 
00137         void* pSZFunct, void* pDelFunct, void* pSizeFunct, 
00138         const AxisChar* pName, const AxisChar* pNamespace)=0;
00139 
00140     virtual int AXISCALL addOutputBasicArrayParam(const Axis_Array* pArray, 
00141         XSDTYPE nType, const AxisChar* pName)=0;
00142 
00143     /* for complex types */
00144     virtual int AXISCALL addOutputCmplxParam(void* pObject, void* pSZFunct, 
00145         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace) = 0;
00146 
00147     virtual int AXISCALL addFaultDetail(void* pObject, void* pSZFunct,
00148         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace) = 0;
00149 
00150     /* Methods used to serialize arrays */
00151     virtual int AXISCALL serializeCmplxArray(const Axis_Array* pArray, 
00152         void* pSZFunct, void* pDelFunct, void* pSizeFunct, 
00153         const AxisChar* pName, const AxisChar* pNamespace)=0;
00154 
00155     virtual int AXISCALL serializeBasicArray
00156         (const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)=0;
00157 
00158     /* Basic Type Serializing methods */
00159     virtual int AXISCALL serializeAsElement(const AxisChar* sName, 
00160         void* pValue, XSDTYPE type)=0;
00161 
00162     virtual int AXISCALL serializeAsAttribute(const AxisChar* sName, 
00163         const AxisChar* pNamespace, void* pValue, XSDTYPE type)=0;
00164 
00165     virtual void AXISCALL serialize(const char* pFirst, ...)=0;
00166 
00167     /* 
00168      * following two functions are needed by serializer 
00169      * functions of complex types for RPC style web services 
00170      */
00171     virtual void AXISCALL serializeStartElementOfType(const AxisChar* pName, 
00172         const AxisChar* pNamespace, const AxisChar* pPrefix)=0;
00173 
00174     virtual void AXISCALL serializeEndElementOfType(const AxisChar* pName)=0;
00175 
00176     /* Externalization of serializer API */
00177 
00178     /* Following functions need not be exposed. They are internal to the
00179          * Axis Engine - Commented by Susantha 02/07/2004
00180 
00181     virtual int setOutputStream(SOAPTransport* pStream)=0;
00182 
00183     virtual void markEndOfStream()=0;    
00184 
00185     virtual int init()=0;    
00186 
00187     virtual void setStyle(AXIS_BINDING_STYLE nStyle)=0;
00188 
00189     virtual AXIS_BINDING_STYLE getStyle()=0;
00190     */
00191 
00192     virtual PROVIDERTYPE getCurrentProviderType()=0;
00193 
00194     virtual void setCurrentProviderType(PROVIDERTYPE nType)=0;    
00195 
00196     virtual int addOutputAnyObject(AnyType* pAnyObject)=0;
00197 
00198     virtual int serializeAnyObject(AnyType* pAnyObject)=0;
00199 
00200     /* following stuff is needed to provide the interface for C web services */
00201 public:
00202     static IWrapperSoapSerializerFunctions ms_VFtable;
00203 
00204     static int AXISCALL s_CreateSoapMethod(void* pObj, 
00205         const AxisChar* sLocalName, const AxisChar* sURI)
00206     { return ((IWrapperSoapSerializer*)pObj)->createSoapMethod
00207     (sLocalName, sURI);};
00208 
00209     static int AXISCALL s_CreateSoapFault(void* pObj, 
00210         const AxisChar* sLocalName, const AxisChar* sURI,
00211         const AxisChar* sFaultCode, const AxisChar* sFaultString)
00212     { return ((IWrapperSoapSerializer*)pObj)->createSoapFault
00213         (sLocalName, sURI, sFaultCode, sFaultString);};
00214 
00215     static const AxisChar* AXISCALL s_GetNamespacePrefix(void* pObj, 
00216         const AxisChar* pNamespace)
00217     { return ((IWrapperSoapSerializer*)pObj)->getNamespacePrefix(pNamespace);};
00218 
00219     static void AXISCALL s_RemoveNamespacePrefix(void* pObj, 
00220         const AxisChar* pNamespace)
00221     { ((IWrapperSoapSerializer*)pObj)->removeNamespacePrefix(pNamespace);};
00222 
00223     static int AXISCALL s_AddOutputParam(void* pObj, const AxisChar* pchName, 
00224         void* pValue, XSDTYPE type)
00225     { return ((IWrapperSoapSerializer*)pObj)->addOutputParam
00226         (pchName, pValue, type);};
00227 
00228     static int AXISCALL s_AddOutputCmplxArrayParam(void* pObj, 
00229         const Axis_Array* pArray, void* pSZFunct, void* pDelFunct, 
00230         void* pSizeFunct, const AxisChar* pName, const AxisChar* pNamespace)
00231     { return ((IWrapperSoapSerializer*)pObj)->addOutputCmplxArrayParam
00232     (pArray, pSZFunct, pDelFunct, pSizeFunct, pName, pNamespace);};
00233 
00234     static int AXISCALL s_AddOutputBasicArrayParam(void* pObj, 
00235         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)
00236     { return ((IWrapperSoapSerializer*)pObj)->addOutputBasicArrayParam
00237     (pArray, nType, pName);};
00238 
00239     static int AXISCALL s_AddOutputCmplxParam(void* pObj, void* pObject, 
00240         void* pSZFunct, void* pDelFunct, const AxisChar* pName, 
00241         const AxisChar* pNamespace)
00242     {   return ((IWrapperSoapSerializer*)pObj)->addOutputCmplxParam
00243         (pObject, pSZFunct, pDelFunct, pName, pNamespace);};
00244 
00245     static int AXISCALL s_AddFaultDetail(void* pObj, void* pObject, 
00246         void* pSZFunct, void* pDelFunct, const AxisChar* pName, 
00247         const AxisChar* pNamespace)
00248     {   return ((IWrapperSoapSerializer*)pObj)->addFaultDetail
00249         (pObject, pSZFunct, pDelFunct, pName, pNamespace);};
00250     
00251     static int AXISCALL s_SerializeCmplxArray(void* pObj, 
00252         const Axis_Array* pArray, void* pSZFunct, void* pDelFunct, 
00253         void* pSizeFunct, const AxisChar* pName, const AxisChar* pNamespace)
00254     { return ((IWrapperSoapSerializer*)pObj)->serializeCmplxArray
00255     (pArray, pSZFunct, pDelFunct, pSizeFunct, pName, pNamespace);};
00256 
00257     static int AXISCALL s_SerializeBasicArray(void* pObj, 
00258         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)
00259     { return ((IWrapperSoapSerializer*)pObj)->serializeBasicArray
00260     (pArray, nType, pName);};
00261 
00262     static int AXISCALL s_SerializeAsElement(void* pObj, 
00263         const AxisChar* sName, void* pValue, XSDTYPE type)
00264     { return ((IWrapperSoapSerializer*)pObj)->serializeAsElement
00265     (sName, pValue, type);};
00266 
00267     static int AXISCALL s_SerializeAsAttribute(void* pObj, 
00268         const AxisChar* sName, const AxisChar* pNamespace, 
00269         void* pValue, XSDTYPE type)
00270     { return ((IWrapperSoapSerializer*)pObj)->serializeAsAttribute
00271     (sName, pNamespace, pValue, type);};
00272 
00273     static void AXISCALL s_Serialize(void* pObj, const char* pFirst)
00274     { ((IWrapperSoapSerializer*)pObj)->serialize(pFirst, 0);};
00275 
00276     static void AXISCALL s_SerializeStartElementOfType(void* pObj, 
00277         const AxisChar* pName, const AxisChar* pNamespace, 
00278         const AxisChar* pPrefix)
00279     { ((IWrapperSoapSerializer*)pObj)->serializeStartElementOfType
00280     (pName, pNamespace, pPrefix);}
00281 
00282     static void AXISCALL s_SerializeEndElementOfType(void* pObj, 
00283         const AxisChar* pName)
00284     { ((IWrapperSoapSerializer*)pObj)->serializeEndElementOfType(pName);}
00285 
00286     static int AXISCALL s_AddOutputAnyObject(void* pObj,
00287         AnyType* pAnyObject)
00288     {
00289         return ((IWrapperSoapSerializer*)pObj)->addOutputAnyObject(pAnyObject);
00290     }
00291 
00292     static int AXISCALL s_SerializeAnyObject(void* pObj,
00293         AnyType* pAnyObject)
00294     {
00295         return ((IWrapperSoapSerializer*)pObj)->serializeAnyObject(pAnyObject);
00296     }
00297 
00298     static void s_Initialize()
00299     {
00300         ms_VFtable.createSoapMethod = s_CreateSoapMethod;
00301         ms_VFtable.createSoapFault = s_CreateSoapFault;
00302         ms_VFtable.getNamespacePrefix = s_GetNamespacePrefix;
00303         ms_VFtable.removeNamespacePrefix = s_RemoveNamespacePrefix;
00304         ms_VFtable.addOutputParam = s_AddOutputParam;
00305         ms_VFtable.addOutputCmplxArrayParam = s_AddOutputCmplxArrayParam;
00306         ms_VFtable.addOutputBasicArrayParam = s_AddOutputBasicArrayParam;
00307         ms_VFtable.addOutputCmplxParam = s_AddOutputCmplxParam;
00308         ms_VFtable.addFaultDetail = s_AddFaultDetail;
00309         ms_VFtable.serializeCmplxArray = s_SerializeCmplxArray;
00310         ms_VFtable.serializeBasicArray = s_SerializeBasicArray;
00311         ms_VFtable.serializeAsElement = s_SerializeAsElement;
00312         ms_VFtable.serializeAsAttribute = s_SerializeAsAttribute;
00313         ms_VFtable.serialize = s_Serialize;
00314         ms_VFtable.serializeStartElementOfType = s_SerializeStartElementOfType;
00315         ms_VFtable.serializeEndElementOfType = s_SerializeEndElementOfType;
00316         ms_VFtable.addOutputAnyObject = s_AddOutputAnyObject;
00317         ms_VFtable.serializeAnyObject = s_SerializeAnyObject;
00318     }
00319 };
00320 
00321 AXIS_CPP_NAMESPACE_END
00322 
00323 #endif
00324 #endif 
00325 
00326 

Generated on Wed Aug 18 11:42:24 2004 for AxisC++ by doxygen1.2.18