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

Generated on Wed Sep 15 14:14:21 2004 for AxisC++ by doxygen1.2.18