You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/08/13 16:11:11 UTC
cvs commit: xml-axis/c/src/soap URIMapping.h URIMapping.cpp SoapSerializer.h SoapSerializer.cpp SoapFaults.h SoapFault.h SoapFault.cpp SoapDeSerializer.h SoapDeSerializer.cpp
susantha 2003/08/13 07:11:11
Modified: c/src/soap URIMapping.h URIMapping.cpp SoapSerializer.h
SoapSerializer.cpp SoapFaults.h SoapFault.h
SoapFault.cpp SoapDeSerializer.h
SoapDeSerializer.cpp
Log:
After making code base thread safe. Also changed Module writing API accordingly. WSDD module too improved.
Revision Changes Path
1.2 +1 -1 xml-axis/c/src/soap/URIMapping.h
Index: URIMapping.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/URIMapping.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URIMapping.h 25 Jun 2003 07:39:08 -0000 1.1
+++ URIMapping.h 13 Aug 2003 14:11:10 -0000 1.2
@@ -83,7 +83,7 @@
public:
static void Initialize();
static map<string, URITYPE> m_sURIMap;
- static bool m_bInit;
+ static volatile bool m_bInit;
URIMapping();
virtual ~URIMapping();
static URITYPE Map(string &uri);
1.2 +1 -1 xml-axis/c/src/soap/URIMapping.cpp
Index: URIMapping.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/URIMapping.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URIMapping.cpp 25 Jun 2003 07:39:08 -0000 1.1
+++ URIMapping.cpp 13 Aug 2003 14:11:10 -0000 1.2
@@ -70,7 +70,7 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
map<string, URITYPE> URIMapping::m_sURIMap;
-bool URIMapping::m_bInit = false;
+volatile bool URIMapping::m_bInit = false;
URIMapping::URIMapping()
{
1.10 +4 -3 xml-axis/c/src/soap/SoapSerializer.h
Index: SoapSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SoapSerializer.h 5 Aug 2003 08:18:55 -0000 1.9
+++ SoapSerializer.h 13 Aug 2003 14:11:10 -0000 1.10
@@ -87,7 +87,7 @@
class SoapSerializer : public IWrapperSoapSerializer, public IHandlerSoapSerializer /*: public ISoapSerializer*/
{
private:
- static int iCounter;
+ int iCounter;
char cCounter[64];
SoapEnvelope* m_pSoapEnvelope;
int m_iSoapVersion;
@@ -100,8 +100,8 @@
//ISoapSerializer& operator<<(const char *cSerialized);
const char* getNewNamespacePrefix();
int setSoapVersion(SOAP_VERSION);
- void init();
- int getStream();
+ int Init();
+ int SetOutputStream(void* pStream);
int setSoapFault(SoapFault* pSoapFault);
int setSoapMethod(SoapMethod* pSoapMethod);
int setSoapBody(SoapBody* pSoapBody);
@@ -120,6 +120,7 @@
string& SerializeBasicType(const string& sName, int nValue);
private:
BasicTypeSerializer m_BTSZ;
+ void* m_pOutputStream;
};
#endif // !defined(AFX_SOAPSERIALIZER_H__C37229AD_BD54_430D_9619_E4574CF95334__INCLUDED_)
1.12 +25 -10 xml-axis/c/src/soap/SoapSerializer.cpp
Index: SoapSerializer.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SoapSerializer.cpp 5 Aug 2003 05:49:16 -0000 1.11
+++ SoapSerializer.cpp 13 Aug 2003 14:11:10 -0000 1.12
@@ -77,15 +77,15 @@
extern "C" int sendSoapResponse(char *cSerializedStream);
-int SoapSerializer::iCounter=0;
-
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SoapSerializer::SoapSerializer()
{
- m_pSoapEnvelope= NULL;
+ m_pSoapEnvelope = NULL;
+ m_iSoapVersion = SOAP_VER_1_1;
+ m_pOutputStream = NULL;
}
SoapSerializer::~SoapSerializer()
@@ -95,14 +95,14 @@
int SoapSerializer::setSoapEnvelope(SoapEnvelope *pSoapEnvelope)
{
- m_pSoapEnvelope= pSoapEnvelope;
+ m_pSoapEnvelope = pSoapEnvelope;
return SUCCESS;
}
int SoapSerializer::setSoapHeader(SoapHeader *pSoapHeader)
{
- int intStatus= FAIL;
+ int intStatus = FAIL;
if(m_pSoapEnvelope) {
@@ -178,8 +178,9 @@
return m_sSerializedStream;
}*/
-int SoapSerializer::getStream()
+int SoapSerializer::SetOutputStream(void* pStream)
{
+ m_pOutputStream = pStream;
int iStatus= SUCCESS;
if(m_pSoapEnvelope) {
@@ -196,7 +197,7 @@
return iStatus;
}
-void SoapSerializer::init()
+int SoapSerializer::Init()
{
//initializing the members of the class. This is needed since
// the same object instance of this class, may be used to server
@@ -207,14 +208,28 @@
m_pSoapEnvelope= NULL;
}
+ //Adding SoapEnvelop and SoapBody to Serializer
+ m_pSoapEnvelope = new SoapEnvelope();
+ m_pSoapEnvelope->setSoapBody(new SoapBody());
+
iCounter=0;
m_iCurrentSerBufferSize=0;
m_cSerializedBuffer[0]='\0'; //make buffer to empty content (as a char*)
+ return SUCCESS;
}
-int SoapSerializer::setSoapVersion(SOAP_VERSION eSOAP_VERSION)
+int SoapSerializer::setSoapVersion(SOAP_VERSION nSoapVersion)
{
- m_iSoapVersion= eSOAP_VERSION;
+ //here the default namespaces of the SoapEnvelop should be added and intialized as well.
+ Attribute* pNS = new Attribute(g_sObjSoapEnvVersionsStruct[nSoapVersion].pchEnvelopePrefix,
+ "xmlns","",g_sObjSoapEnvVersionsStruct[nSoapVersion].pchEnvelopeNamespaceUri);
+ m_pSoapEnvelope->addNamespaceDecl(pNS);
+ //add namespace URIs for xsd and xsi
+ pNS = new Attribute("xsd","xmlns","","http://www.w3.org/2001/XMLSchema");
+ m_pSoapEnvelope->addNamespaceDecl(pNS);
+ pNS = new Attribute("xsi","xmlns","","http://www.w3.org/2001/XMLSchema-instance");
+ m_pSoapEnvelope->addNamespaceDecl(pNS);
+
return SUCCESS;
}
@@ -246,7 +261,7 @@
//cout<<"++++++++++++++++"<<"flushed"<<endl;
//cout<<"++++++++++++++++"<<m_cSerializedBuffer<<endl;
//sendSoapResponse(m_cSerializedBuffer);
- send_response_bytes(m_cSerializedBuffer);
+ send_response_bytes(m_cSerializedBuffer, m_pOutputStream);
m_cSerializedBuffer[0]= '\0';
m_iCurrentSerBufferSize=0;
1.4 +1 -1 xml-axis/c/src/soap/SoapFaults.h
Index: SoapFaults.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapFaults.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoapFaults.h 15 Jul 2003 08:14:43 -0000 1.3
+++ SoapFaults.h 13 Aug 2003 14:11:10 -0000 1.4
@@ -97,7 +97,7 @@
SF_SOAPCONTENTERROR,
SF_NOSOAPMETHOD,
SF_METHODNOTALLOWED,
- SF_PARATYPEMISMATCH,
+ SF_PARATYPEMISMATCH,
//Server faults
SF_COULDNOTLOADSRV,
1.4 +1 -1 xml-axis/c/src/soap/SoapFault.h
Index: SoapFault.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapFault.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoapFault.h 15 Jul 2003 07:05:06 -0000 1.3
+++ SoapFault.h 13 Aug 2003 14:11:10 -0000 1.4
@@ -97,7 +97,7 @@
string m_sFaultstring;
string m_sFaultcode;
static map<int, SoapFaultStruct> m_sFaultMap;
- static bool m_bInit;
+ static volatile bool m_bInit;
//int setDetail(const string& sDetail);
//int setFaultactor(const string& sFaultactor);
//int setFaultstring(const string& sFaultstring);
1.4 +1 -1 xml-axis/c/src/soap/SoapFault.cpp
Index: SoapFault.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapFault.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoapFault.cpp 15 Jul 2003 07:05:06 -0000 1.3
+++ SoapFault.cpp 13 Aug 2003 14:11:10 -0000 1.4
@@ -75,7 +75,7 @@
//////////////////////////////////////////////////////////////////////
map<int, SoapFaultStruct> SoapFault::m_sFaultMap;
-bool SoapFault::m_bInit = false;
+volatile bool SoapFault::m_bInit = false;
SoapFault::SoapFault()
{
1.7 +3 -2 xml-axis/c/src/soap/SoapDeSerializer.h
Index: SoapDeSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapDeSerializer.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SoapDeSerializer.h 5 Aug 2003 08:18:55 -0000 1.6
+++ SoapDeSerializer.h 13 Aug 2003 14:11:10 -0000 1.7
@@ -86,10 +86,11 @@
private:
XMLStreamHandler* m_pHandler;
SAX2XMLReader* m_pParser;
+ void* m_pInputStream;
public:
int GetVersion();
string& GetMethodName();
- void Init();
+ int Init();
IParam* GetParam();
int Deserialize(IParam* pIParam, int bHref);
SoapFault* GetFault();
@@ -97,7 +98,7 @@
SoapBody* GetBody();
ISoapHeader* GetHeader();
SoapEnvelope* GetEnvelope();
- int SetStream(InputSource* sStream);
+ int SetInputStream(void* InputStream);
SoapDeSerializer();
virtual ~SoapDeSerializer();
1.5 +23 -6 xml-axis/c/src/soap/SoapDeSerializer.cpp
Index: SoapDeSerializer.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapDeSerializer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SoapDeSerializer.cpp 5 Aug 2003 08:18:55 -0000 1.4
+++ SoapDeSerializer.cpp 13 Aug 2003 14:11:10 -0000 1.5
@@ -71,7 +71,7 @@
#include "SoapFault.h"
#include "SoapDeSerializer.h"
#include "../common/GDefine.h"
-class ISoapHeader;
+#include "../common/Packet.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -83,6 +83,7 @@
m_pParser = XMLReaderFactory::createXMLReader();
m_pParser->setContentHandler(m_pHandler);
m_pParser->setErrorHandler(m_pHandler);
+ m_pInputStream = NULL;
}
SoapDeSerializer::~SoapDeSerializer()
@@ -91,10 +92,25 @@
delete m_pParser;
}
-int SoapDeSerializer::SetStream(InputSource *sStream)
+int SoapDeSerializer::SetInputStream(void* InputStream)
{
- //m_pParser->
- m_pParser->parse(*sStream);
+ m_pInputStream = InputStream;
+ MemBufInputSource* pSoapInput = NULL;
+ //---------------------start--------------------------
+ //Deserialize
+ //---------START XERCES SAX2 SPCIFIC CODE---------//
+ //a huge buffer to store the whole soap request stream
+ char hugebuffer[10000];
+ //to store the number of chars returned by get_request_bytes
+ int nChars = 0;
+ //request a huge number of bytes to get the whole soap request
+ //when pull parsing is used this should change
+ get_request_bytes(hugebuffer, 10000, &nChars, m_pInputStream);
+ //if no soap then quit
+ if (nChars <= 0) return FAIL;
+ pSoapInput = new MemBufInputSource((const unsigned char*)hugebuffer, nChars ,"bufferid",false);
+
+ m_pParser->parse(*pSoapInput);
return SUCCESS;
}
@@ -108,7 +124,7 @@
//actually here a dynamic cast is not needed. But it is
// done for safe side, incase SoapHeader derives from
// more that one interface and the deriving order changes.
- return dynamic_cast<ISoapHeader*>(m_pHandler->m_pHead);
+ return static_cast<ISoapHeader*>(m_pHandler->m_pHead);
}
SoapBody* SoapDeSerializer::GetBody()
@@ -160,9 +176,10 @@
return m_pHandler->GetParam();
}
-void SoapDeSerializer::Init()
+int SoapDeSerializer::Init()
{
m_pHandler->Init();
+ return SUCCESS;
}
string& SoapDeSerializer::GetMethodName()