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 class IWrapperSoapSerializer : public ISoapSerializer
00112 {
00113 public:
00114     virtual ~IWrapperSoapSerializer(){};
00115 
00116     virtual int AXISCALL createSoapMethod(const AxisChar* sLocalName, 
00117         const AxisChar* sURI)=0;
00118 
00119     virtual int AXISCALL createSoapFault(const AxisChar* sLocalName, 
00120         const AxisChar* sURI, const AxisChar* sFaultCode,
00121         const AxisChar* sFaultString)=0;
00122 
00123     virtual const AxisChar* AXISCALL getNamespacePrefix
00124         (const AxisChar* pNamespace)=0;
00125 
00126     virtual void AXISCALL removeNamespacePrefix(const AxisChar* pNamespace)=0;
00127 
00128     /* for basic types */
00129     virtual int AXISCALL addOutputParam(const AxisChar* pchName, void* pValue, 
00130         XSDTYPE type)=0;
00131 
00132     /* for arrays */
00133     virtual int AXISCALL addOutputCmplxArrayParam(const Axis_Array* pArray, 
00134         void* pSZFunct, void* pDelFunct, void* pSizeFunct, 
00135         const AxisChar* pName, const AxisChar* pNamespace)=0;
00136 
00137     virtual int AXISCALL addOutputBasicArrayParam(const Axis_Array* pArray, 
00138         XSDTYPE nType, const AxisChar* pName)=0;
00139 
00140     /* for complex types */
00141     virtual int AXISCALL addOutputCmplxParam(void* pObject, void* pSZFunct, 
00142         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace) = 0;
00143 
00144     virtual int AXISCALL addFaultDetail(void* pObject, void* pSZFunct,
00145         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace) = 0;
00146 
00147     /* Methods used to serialize arrays */
00148     virtual int AXISCALL serializeCmplxArray(const Axis_Array* pArray, 
00149         void* pSZFunct, void* pDelFunct, void* pSizeFunct, 
00150         const AxisChar* pName, const AxisChar* pNamespace)=0;
00151 
00152     virtual int AXISCALL serializeBasicArray
00153         (const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)=0;
00154 
00155     /* Basic Type Serializing methods */
00156     virtual int AXISCALL serializeAsElement(const AxisChar* sName, 
00157         void* pValue, XSDTYPE type)=0;
00158 
00159     virtual int AXISCALL serializeAsAttribute(const AxisChar* sName, 
00160         const AxisChar* pNamespace, void* pValue, XSDTYPE type)=0;
00161 
00162     virtual void AXISCALL serialize(const char* pFirst, ...)=0;
00163 
00164     /* 
00165      * following two functions are needed by serializer 
00166      * functions of complex types for RPC style web services 
00167      */
00168     virtual void AXISCALL serializeStartElementOfType(const AxisChar* pName, 
00169         const AxisChar* pNamespace, const AxisChar* pPrefix)=0;
00170 
00171     virtual void AXISCALL serializeEndElementOfType(const AxisChar* pName)=0;
00172 
00173     /* Externalization of serializer API */
00174 
00175     /* Following functions need not be exposed. They are internal to the
00176          * Axis Engine - Commented by Susantha 02/07/2004
00177 
00178     virtual int setOutputStream(SOAPTransport* pStream)=0;
00179 
00180     virtual void markEndOfStream()=0;    
00181 
00182     virtual int init()=0;    
00183 
00184     virtual void setStyle(AXIS_BINDING_STYLE nStyle)=0;
00185 
00186     virtual AXIS_BINDING_STYLE getStyle()=0;
00187     */
00188 
00189     virtual PROVIDERTYPE getCurrentProviderType()=0;
00190 
00191     virtual void setCurrentProviderType(PROVIDERTYPE nType)=0;    
00192 
00193     virtual int addOutputAnyObject(AnyType* pAnyObject)=0;
00194 
00195     virtual int serializeAnyObject(AnyType* pAnyObject)=0;
00196 
00197     /* following stuff is needed to provide the interface for C web services */
00198 public:
00199     static IWrapperSoapSerializerFunctions ms_VFtable;
00200 
00201     static int AXISCALL s_CreateSoapMethod(void* pObj, 
00202         const AxisChar* sLocalName, const AxisChar* sURI)
00203     { return ((IWrapperSoapSerializer*)pObj)->createSoapMethod
00204     (sLocalName, sURI);};
00205 
00206     static int AXISCALL s_CreateSoapFault(void* pObj, 
00207         const AxisChar* sLocalName, const AxisChar* sURI,
00208         const AxisChar* sFaultCode, const AxisChar* sFaultString)
00209     { return ((IWrapperSoapSerializer*)pObj)->createSoapFault
00210         (sLocalName, sURI, sFaultCode, sFaultString);};
00211 
00212     static const AxisChar* AXISCALL s_GetNamespacePrefix(void* pObj, 
00213         const AxisChar* pNamespace)
00214     { return ((IWrapperSoapSerializer*)pObj)->getNamespacePrefix(pNamespace);};
00215 
00216     static void AXISCALL s_RemoveNamespacePrefix(void* pObj, 
00217         const AxisChar* pNamespace)
00218     { ((IWrapperSoapSerializer*)pObj)->removeNamespacePrefix(pNamespace);};
00219 
00220     static int AXISCALL s_AddOutputParam(void* pObj, const AxisChar* pchName, 
00221         void* pValue, XSDTYPE type)
00222     { return ((IWrapperSoapSerializer*)pObj)->addOutputParam
00223         (pchName, pValue, type);};
00224 
00225     static int AXISCALL s_AddOutputCmplxArrayParam(void* pObj, 
00226         const Axis_Array* pArray, void* pSZFunct, void* pDelFunct, 
00227         void* pSizeFunct, const AxisChar* pName, const AxisChar* pNamespace)
00228     { return ((IWrapperSoapSerializer*)pObj)->addOutputCmplxArrayParam
00229     (pArray, pSZFunct, pDelFunct, pSizeFunct, pName, pNamespace);};
00230 
00231     static int AXISCALL s_AddOutputBasicArrayParam(void* pObj, 
00232         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)
00233     { return ((IWrapperSoapSerializer*)pObj)->addOutputBasicArrayParam
00234     (pArray, nType, pName);};
00235 
00236     static int AXISCALL s_AddOutputCmplxParam(void* pObj, void* pObject, 
00237         void* pSZFunct, void* pDelFunct, const AxisChar* pName, 
00238         const AxisChar* pNamespace)
00239     {   return ((IWrapperSoapSerializer*)pObj)->addOutputCmplxParam
00240         (pObject, pSZFunct, pDelFunct, pName, pNamespace);};
00241 
00242     static int AXISCALL s_AddFaultDetail(void* pObj, void* pObject, 
00243         void* pSZFunct, void* pDelFunct, const AxisChar* pName, 
00244         const AxisChar* pNamespace)
00245     {   return ((IWrapperSoapSerializer*)pObj)->addFaultDetail
00246         (pObject, pSZFunct, pDelFunct, pName, pNamespace);};
00247     
00248     static int AXISCALL s_SerializeCmplxArray(void* pObj, 
00249         const Axis_Array* pArray, void* pSZFunct, void* pDelFunct, 
00250         void* pSizeFunct, const AxisChar* pName, const AxisChar* pNamespace)
00251     { return ((IWrapperSoapSerializer*)pObj)->serializeCmplxArray
00252     (pArray, pSZFunct, pDelFunct, pSizeFunct, pName, pNamespace);};
00253 
00254     static int AXISCALL s_SerializeBasicArray(void* pObj, 
00255         const Axis_Array* pArray, XSDTYPE nType, const AxisChar* pName)
00256     { return ((IWrapperSoapSerializer*)pObj)->serializeBasicArray
00257     (pArray, nType, pName);};
00258 
00259     static int AXISCALL s_SerializeAsElement(void* pObj, 
00260         const AxisChar* sName, void* pValue, XSDTYPE type)
00261     { return ((IWrapperSoapSerializer*)pObj)->serializeAsElement
00262     (sName, pValue, type);};
00263 
00264     static int AXISCALL s_SerializeAsAttribute(void* pObj, 
00265         const AxisChar* sName, const AxisChar* pNamespace, 
00266         void* pValue, XSDTYPE type)
00267     { return ((IWrapperSoapSerializer*)pObj)->serializeAsAttribute
00268     (sName, pNamespace, pValue, type);};
00269 
00270     static void AXISCALL s_Serialize(void* pObj, const char* pFirst)
00271     { ((IWrapperSoapSerializer*)pObj)->serialize(pFirst, 0);};
00272 
00273     static void AXISCALL s_SerializeStartElementOfType(void* pObj, 
00274         const AxisChar* pName, const AxisChar* pNamespace, 
00275         const AxisChar* pPrefix)
00276     { ((IWrapperSoapSerializer*)pObj)->serializeStartElementOfType
00277     (pName, pNamespace, pPrefix);}
00278 
00279     static void AXISCALL s_SerializeEndElementOfType(void* pObj, 
00280         const AxisChar* pName)
00281     { ((IWrapperSoapSerializer*)pObj)->serializeEndElementOfType(pName);}
00282 
00283     static int AXISCALL s_AddOutputAnyObject(void* pObj,
00284         AnyType* pAnyObject)
00285     {
00286         return ((IWrapperSoapSerializer*)pObj)->addOutputAnyObject(pAnyObject);
00287     }
00288 
00289     static int AXISCALL s_SerializeAnyObject(void* pObj,
00290         AnyType* pAnyObject)
00291     {
00292         return ((IWrapperSoapSerializer*)pObj)->serializeAnyObject(pAnyObject);
00293     }
00294 
00295     static void s_Initialize()
00296     {
00297         ms_VFtable.createSoapMethod = s_CreateSoapMethod;
00298         ms_VFtable.createSoapFault = s_CreateSoapFault;
00299         ms_VFtable.getNamespacePrefix = s_GetNamespacePrefix;
00300         ms_VFtable.removeNamespacePrefix = s_RemoveNamespacePrefix;
00301         ms_VFtable.addOutputParam = s_AddOutputParam;
00302         ms_VFtable.addOutputCmplxArrayParam = s_AddOutputCmplxArrayParam;
00303         ms_VFtable.addOutputBasicArrayParam = s_AddOutputBasicArrayParam;
00304         ms_VFtable.addOutputCmplxParam = s_AddOutputCmplxParam;
00305         ms_VFtable.addFaultDetail = s_AddFaultDetail;
00306         ms_VFtable.serializeCmplxArray = s_SerializeCmplxArray;
00307         ms_VFtable.serializeBasicArray = s_SerializeBasicArray;
00308         ms_VFtable.serializeAsElement = s_SerializeAsElement;
00309         ms_VFtable.serializeAsAttribute = s_SerializeAsAttribute;
00310         ms_VFtable.serialize = s_Serialize;
00311         ms_VFtable.serializeStartElementOfType = s_SerializeStartElementOfType;
00312         ms_VFtable.serializeEndElementOfType = s_SerializeEndElementOfType;
00313         ms_VFtable.addOutputAnyObject = s_AddOutputAnyObject;
00314         ms_VFtable.serializeAnyObject = s_SerializeAnyObject;
00315     }
00316 };
00317 
00318 #endif
00319 #endif 
00320 
00321 

Generated on Fri Jul 9 13:18:29 2004 for AxisC++ by doxygen1.2.18