00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(_SOAPSERIALIZER_H____OF_AXIS_INCLUDED_)
00018 #define _SOAPSERIALIZER_H____OF_AXIS_INCLUDED_
00019
00020 #include "IHandlerSoapSerializer.h"
00021 #include "BasicTypeSerializer.h"
00022 #include "AxisTime.h"
00023 #include "Packet.h"
00024 #include "WSDDDefines.h"
00025 #include "SoapEnvVersions.h"
00026 #include <axis/AxisSoapException.h>
00027
00028 class SoapEnvelope;
00029 class SoapHeader;
00030 class SoapMethod;
00031 class SoapBody;
00032 class SoapFault;
00033 class HeaderBlock;
00034
00035 #include <map>
00036 using namespace std;
00037
00048 class SoapSerializer : public IHandlerSoapSerializer
00049 {
00050 typedef struct
00051 {
00052 volatile unsigned char inuse;
00053 volatile char* buffer;
00054 } SerializeBuffers;
00055 private:
00056 int m_nCounter;
00057 AxisChar m_Buf[8];
00058 SoapEnvelope* m_pSoapEnvelope;
00059 int m_iSoapVersion;
00060
00061 AXIS_BINDING_STYLE m_nStyle;
00062
00063 volatile SerializeBuffers* m_pSZBuffers;
00064
00065 int m_nInitialBufferSize;
00066
00067 int m_nMaxBuffersToCreate;
00068
00069 int m_nCurrentBufferSize;
00070
00071 int m_nFilledSize;
00072
00073 int m_nCurrentBufferIndex;
00074
00075
00076
00077 int m_nStatus;
00078
00079
00080
00081 map<AxisXMLString, AxisXMLString> m_NsStack;
00082
00083 PROVIDERTYPE m_ProviderType;
00084 public:
00085
00086 #ifdef UNIT_TESTING_ON
00087 int setOutputStreamForTesting(SOAPTransport* pStream);
00088 #endif
00089 int AXISCALL createSoapMethod(const AxisChar* sLocalName,
00090 const AxisChar* sURI);
00091
00092 int AXISCALL createSoapFault(const AxisChar* sLocalName,
00093 const AxisChar* sURI);
00094
00095
00096 IWrapperSoapSerializer& operator<<(const AxisChar* cSerialized);
00102 const AxisChar* AXISCALL getNamespacePrefix(const AxisChar* pNamespace);
00112 const AxisChar* AXISCALL getNamespacePrefix(const AxisChar* pNamespace,
00113 bool& blnIsNewPrefix);
00114 void AXISCALL removeNamespacePrefix(const AxisChar* pNamespace);
00115 int setSoapVersion(SOAP_VERSION);
00116 int init();
00117 int setOutputStream(SOAPTransport* pStream);
00118 void markEndOfStream();
00119 int setSoapMethod(SoapMethod* pSoapMethod);
00120 int setSoapFault(SoapFault* pSoapFault);
00121 int setSoapBody(SoapBody* pSoapBody);
00122 int setSoapHeader(SoapHeader* pSoapHeader);
00123 int setSoapEnvelope(SoapEnvelope* pSoapEnvelope);
00124 SoapSerializer();
00125 virtual ~SoapSerializer();
00126
00127
00128 int AXISCALL addOutputBasicArrayParam(const Axis_Array* pArray,
00129 XSDTYPE nType, const AxisChar* pName);
00130
00131
00132 int AXISCALL addOutputCmplxArrayParam(const Axis_Array* pArray,
00133 void* pSZFunct, void* pDelFunct, void* pSizeFunct,
00134 const AxisChar* pName, const AxisChar* pNamespace);
00135
00136
00137 int AXISCALL addOutputCmplxParam(void* pObject, void* pSZFunct,
00138 void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace);
00139
00140 int AXISCALL addFaultDetail(void* pObject, void* pSZFunct,
00141 void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace );
00142
00143 int AXISCALL serializeCmplxArray(const Axis_Array* pArray, void* pSZFunct,
00144 void* pDelFunct, void* pSizeFunct, const AxisChar* pName,
00145 const AxisChar* pNamespace);
00146
00147 int AXISCALL serializeBasicArray(const Axis_Array* pArray, XSDTYPE nType,
00148 const AxisChar* pName);
00149
00150
00151
00152 void AXISCALL serializeStartElementOfType(const AxisChar* pName,
00153 const AxisChar* pNamespace, const AxisChar* pPrefix);
00154 void AXISCALL serializeEndElementOfType(const AxisChar* pName);
00155 PROVIDERTYPE getCurrentProviderType() { return m_ProviderType;};
00156 void setCurrentProviderType(PROVIDERTYPE nType) { m_ProviderType = nType;};
00157
00158 private:
00159 int sendSerializedBuffer();
00160 int setNextSerilizeBuffer();
00161 IArrayBean* makeArrayBean(XSDTYPE nType, void* pArray);
00162 IArrayBean* makeArrayBean(void* pObject, void* pSZFunct, void* pDelFunct,
00163 void* pSizeFunct);
00164
00165 public:
00166 int removeSoapHeader();
00167 int setHeaderBlock(HeaderBlock* pHeaderBlock);
00168 IHeaderBlock* createHeaderBlock();
00169
00170 private:
00171 BasicTypeSerializer m_BTSZ;
00172 SOAPTransport* m_pOutputStream;
00173 public:
00174 IHeaderBlock* getHeaderBlock(const AxisChar* pcName, const AxisChar* pcNamespace);
00175 IHeaderBlock* getHeaderBlock();
00176 int setSOAPMethodAttribute(Attribute* pAttribute);
00177 SoapMethod* getSOAPMethod();
00178 IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName,
00179 AxisChar *pachUri);
00180
00181 int AXISCALL addHeaderBlock(IHeaderBlock* pBlk);
00182 int AXISCALL addOutputParam(const AxisChar* pchName,
00183 void* pValue, XSDTYPE type);
00184 int AXISCALL serializeAsElement(const AxisChar* pchName,
00185 void* pValue, XSDTYPE type);
00186 int AXISCALL serializeAsAttribute(const AxisChar* pName,
00187 const AxisChar* pNamespace, void* pValue, XSDTYPE type);
00188 void AXISCALL serialize(const char* pFirst, ...);
00189 void setStyle(AXIS_BINDING_STYLE nStyle)
00190 { m_nStyle = nStyle; m_BTSZ.setStyle(nStyle);};
00191 AXIS_BINDING_STYLE getStyle(){return m_nStyle;};
00192 int AXISCALL setBodyAsHexBinary(xsd__hexBinary body);
00193 int AXISCALL setBodyAsBase64Binary(xsd__base64Binary body);
00194 const AxisChar* AXISCALL getBodyAsString();
00195 static void AXISCALL releaseBufferCallBack(const char* buffer,
00196 const void* bufferid);
00197 int addOutputAnyObject(AnyType* pAnyObject);
00198 int serializeAnyObject(AnyType* pAnyObject);
00199 };
00200
00201 #endif
00202
00203