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

Generated on Tue Jun 29 09:27:56 2004 for AxisC++ by doxygen1.2.18