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 ro...@apache.org on 2003/08/05 10:18:55 UTC
cvs commit: xml-axis/c/src/soap BasicNode.cpp BasicNode.h CharacterElement.cpp CharacterElement.h ComplexElement.cpp ComplexElement.h HeaderBlock.cpp HeaderBlock.h SoapDeSerializer.cpp SoapDeSerializer.h SoapHeader.cpp SoapHeader.h SoapSerializer.h XMLStreamHandler.cpp XMLStreamHandler.h
roshan 2003/08/05 01:18:55
Modified: c/src/common IHandlerSoapDeSerializer.h IHeaderBlock.h
IMessageData.h ISoapHeader.h
IWrapperSoapDeSerializer.h MessageData.cpp
MessageData.h IHandlerSoapSerializer.h
IWrapperSoapSerializer.h
c/src/soap BasicNode.cpp BasicNode.h CharacterElement.cpp
CharacterElement.h ComplexElement.cpp
ComplexElement.h HeaderBlock.cpp HeaderBlock.h
SoapDeSerializer.cpp SoapDeSerializer.h
SoapHeader.cpp SoapHeader.h SoapSerializer.h
XMLStreamHandler.cpp XMLStreamHandler.h
Log:
after introducing the new DeSerializer interfaces IWrapperSoapDeSerializer and IHandlerSoapDeSerializer. Also changes contains to deal with SOAP Headers
Revision Changes Path
1.2 +5 -2 xml-axis/c/src/common/IHandlerSoapDeSerializer.h
Index: IHandlerSoapDeSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IHandlerSoapDeSerializer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IHandlerSoapDeSerializer.h 1 Aug 2003 14:34:53 -0000 1.1
+++ IHandlerSoapDeSerializer.h 5 Aug 2003 08:18:54 -0000 1.2
@@ -71,10 +71,13 @@
#pragma once
#endif // _MSC_VER > 1000
-class IHandlerSoapDeSerializer : public ISoapDeSerializer
+#include "ISoapDeSerializer.h"
+class ISoapHeader;
+
+class IHandlerSoapDeSerializer : public virtual ISoapDeSerializer
{
public:
-
+ virtual ISoapHeader* GetHeader()=0;
virtual ~IHandlerSoapDeSerializer() {};
};
1.2 +7 -2 xml-axis/c/src/common/IHeaderBlock.h
Index: IHeaderBlock.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IHeaderBlock.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IHeaderBlock.h 26 Jul 2003 12:38:31 -0000 1.1
+++ IHeaderBlock.h 5 Aug 2003 08:18:54 -0000 1.2
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -72,13 +72,18 @@
#pragma once
#endif // _MSC_VER > 1000
+#include "BasicNode.h"
+
class IHeaderBlock
{
public:
+ virtual BasicNode* createChild(NODE_TYPE eNODE_TYPE)=0;
+ virtual BasicNode* getFirstChild()=0;
+ virtual int addChild(BasicNode* pBasicNode)=0;
virtual void setLocalName(const string &localname)=0;
virtual void setUri(const string &uri)=0;
virtual void setPrefix(const string &prefix)=0;
- virtual void setValue(const string &value)=0;
+ virtual void setValue(const string &value)=0;
virtual ~IHeaderBlock() {};
};
1.7 +3 -0 xml-axis/c/src/common/IMessageData.h
Index: IMessageData.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IMessageData.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IMessageData.h 1 Aug 2003 14:34:53 -0000 1.6
+++ IMessageData.h 5 Aug 2003 08:18:54 -0000 1.7
@@ -79,6 +79,9 @@
class IMessageData
{
public:
+ virtual int setProperty(string& sName, string& sValue)=0;
+ virtual string& getProperty(string& sName)=0;
+
virtual void getSoapSerializer(IHandlerSoapSerializer** pIHandlerSoapSerializer)=0;
virtual void getSoapSerializer(IWrapperSoapSerializer** pIWrapperSoapSerializer)=0;
/*
1.2 +2 -2 xml-axis/c/src/common/ISoapHeader.h
Index: ISoapHeader.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/ISoapHeader.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ISoapHeader.h 26 Jul 2003 12:38:31 -0000 1.1
+++ ISoapHeader.h 5 Aug 2003 08:18:54 -0000 1.2
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -75,7 +75,7 @@
class ISoapHeader
{
public:
- virtual void addHeaderBlock(IHeaderBlock* pIHeaderBlock)=0;
+ virtual IHeaderBlock* getHeaderBlock()=0;
virtual ~ISoapHeader() {};
};
1.2 +1 -1 xml-axis/c/src/common/IWrapperSoapDeSerializer.h
Index: IWrapperSoapDeSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IWrapperSoapDeSerializer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IWrapperSoapDeSerializer.h 1 Aug 2003 14:34:53 -0000 1.1
+++ IWrapperSoapDeSerializer.h 5 Aug 2003 08:18:54 -0000 1.2
@@ -76,7 +76,7 @@
using namespace std;
class IParam;
-class IWrapperSoapDeSerializer : public ISoapDeSerializer
+class IWrapperSoapDeSerializer : public virtual ISoapDeSerializer
{
public:
virtual string& GetMethodName()=0;
1.8 +25 -0 xml-axis/c/src/common/MessageData.cpp
Index: MessageData.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/MessageData.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MessageData.cpp 5 Aug 2003 05:45:38 -0000 1.7
+++ MessageData.cpp 5 Aug 2003 08:18:54 -0000 1.8
@@ -70,6 +70,8 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
+string MessageData::m_sBlankPropertyValue="";
+
MessageData::MessageData()
{
m_pSZ = NULL;
@@ -155,4 +157,27 @@
void MessageData::getSoapDeSerializer(IHandlerSoapDeSerializer **pIHandlerSoapDeSerializer)
{
*pIHandlerSoapDeSerializer= static_cast<IHandlerSoapDeSerializer*>(m_pDZ);
+}
+
+int MessageData::setProperty(string &sName, string &sValue)
+{
+ m_Properties[sName.c_str()]= sValue;
+ return SUCCESS;
+}
+
+/*
+ *The method caller has to check whether the returned string is empty or
+ * not. If it is empty then the idea is that the property is not
+ * available.
+ */
+string& MessageData::getProperty(string &sName)
+{
+
+ if (m_Properties.find(sName) != m_Properties.end())
+ {
+ return m_Properties[sName];
+ }
+
+
+ return m_sBlankPropertyValue;
}
1.8 +4 -0 xml-axis/c/src/common/MessageData.h
Index: MessageData.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/MessageData.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MessageData.h 1 Aug 2003 14:34:53 -0000 1.7
+++ MessageData.h 5 Aug 2003 08:18:54 -0000 1.8
@@ -94,6 +94,8 @@
SoapSerializer* m_pSZ;
SoapDeSerializer* m_pDZ;
public:
+ string& getProperty(string& sName);
+ int setProperty(string& sName, string& sValue);
void getSoapDeSerializer(IHandlerSoapDeSerializer** pIHandlerSoapDeSerializer);
void getSoapDeSerializer(IWrapperSoapDeSerializer** pIWrapperSoapDeSerializer);
void getSoapSerializer(IHandlerSoapSerializer** pIHandlerSoapSerializer);
@@ -119,6 +121,8 @@
private:
bool m_bPastPivotState;
+ map <string, string> m_Properties;
+ static string m_sBlankPropertyValue;
};
#endif // !defined(AFX_MESSAGEDATA_H__8B839E07_3D23_46C6_8743_543B4917D202__INCLUDED_)
1.3 +3 -3 xml-axis/c/src/common/IHandlerSoapSerializer.h
Index: IHandlerSoapSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IHandlerSoapSerializer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IHandlerSoapSerializer.h 4 Aug 2003 06:36:33 -0000 1.2
+++ IHandlerSoapSerializer.h 5 Aug 2003 08:18:54 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -73,10 +73,10 @@
#endif // _MSC_VER > 1000
#include "ISoapSerializer.h"
-class ISoapHeader;
class IHeaderBlock;
-class IHandlerSoapSerializer : virtual public ISoapSerializer
+class IHandlerSoapSerializer : public virtual ISoapSerializer
+
{
public:
virtual IHeaderBlock* createHeaderBlock()=0;
1.3 +2 -4 xml-axis/c/src/common/IWrapperSoapSerializer.h
Index: IWrapperSoapSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IWrapperSoapSerializer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IWrapperSoapSerializer.h 4 Aug 2003 06:36:33 -0000 1.2
+++ IWrapperSoapSerializer.h 5 Aug 2003 08:18:54 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -72,7 +72,6 @@
#pragma once
#endif // _MSC_VER > 1000
-class ISoapSerializer;
class ISoapMethod;
class IArrayBean;
class IParam;
@@ -80,9 +79,8 @@
#include "TypeMapping.h"
#include "ISoapSerializer.h"
-class IWrapperSoapSerializer : virtual public ISoapSerializer
+class IWrapperSoapSerializer : public virtual ISoapSerializer
{
-
public:
virtual IParam* setResponseParam(XSDTYPE nType, uParamValue Value)=0;
virtual ISoapMethod* createSoapMethod()=0;
1.2 +1 -11 xml-axis/c/src/soap/BasicNode.cpp
Index: BasicNode.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/BasicNode.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BasicNode.cpp 27 Jun 2003 04:47:21 -0000 1.1
+++ BasicNode.cpp 5 Aug 2003 08:18:55 -0000 1.2
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcsworld.com, roshan@opensource.lk)
*
*/
@@ -70,13 +70,3 @@
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-
-BasicNode::BasicNode()
-{
-
-}
-
-BasicNode::~BasicNode()
-{
-
-}
1.4 +6 -3 xml-axis/c/src/soap/BasicNode.h
Index: BasicNode.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/BasicNode.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasicNode.h 21 Jul 2003 14:21:09 -0000 1.3
+++ BasicNode.h 5 Aug 2003 08:18:55 -0000 1.4
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcsworld.com, roshan@opensource.lk)
*
*/
@@ -82,12 +82,15 @@
class BasicNode
{
public:
+ virtual string& getValue()=0;
+ virtual int setValue(string& sValue)=0;
+ virtual NODE_TYPE getNodeType()=0;
virtual int serialize(SoapSerializer& pSZ) =0;
- BasicNode();
- virtual ~BasicNode();
+ virtual ~BasicNode() {};
protected:
NODE_TYPE m_iNodeType;
+ string m_sValue;
};
#endif // !defined(AFX_BASICNODE_H__623900B8_2737_4E36_8F26_97898C5BD47D__INCLUDED_)
1.3 +18 -1 xml-axis/c/src/soap/CharacterElement.cpp
Index: CharacterElement.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/CharacterElement.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CharacterElement.cpp 15 Jul 2003 07:09:01 -0000 1.2
+++ CharacterElement.cpp 5 Aug 2003 08:18:55 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -73,6 +73,11 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
+CharacterElement::CharacterElement()
+{
+ m_iNodeType= CHARACTER_NODE;
+}
+
CharacterElement::CharacterElement(const string& sValue)
{
m_sValue= sValue;
@@ -109,3 +114,15 @@
return SUCCESS;
}
*/
+
+string& CharacterElement::getValue()
+{
+ return m_sValue;
+}
+
+int CharacterElement::setValue(string &sValue)
+{
+ m_sValue= sValue;
+
+ return SUCCESS;
+}
1.3 +4 -4 xml-axis/c/src/soap/CharacterElement.h
Index: CharacterElement.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/CharacterElement.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CharacterElement.h 15 Jul 2003 07:09:01 -0000 1.2
+++ CharacterElement.h 5 Aug 2003 08:18:55 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -77,13 +77,13 @@
class CharacterElement : public BasicNode
{
public:
+ int setValue(string& sValue);
+ string& getValue();
int serialize(SoapSerializer& pSZ);
NODE_TYPE getNodeType();
CharacterElement(const string& sValue);
+ CharacterElement();
virtual ~CharacterElement();
-
-private:
- string m_sValue;
};
#endif // !defined(AFX_HARACTERELEMENT_H__55176899_E8B1_40ED_BA39_CB8C5590B4D2__INCLUDED_)
1.3 +32 -3 xml-axis/c/src/soap/ComplexElement.cpp
Index: ComplexElement.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/ComplexElement.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComplexElement.cpp 15 Jul 2003 07:09:01 -0000 1.2
+++ ComplexElement.cpp 5 Aug 2003 08:18:55 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -75,7 +75,7 @@
ComplexElement::ComplexElement()
{
-
+ m_iNodeType= ELEMENT_NODE;
}
ComplexElement::~ComplexElement()
@@ -248,4 +248,33 @@
return SUCCESS;
}
-*/
\ No newline at end of file
+*/
+
+NODE_TYPE ComplexElement::getNodeType()
+{
+ return m_iNodeType;
+}
+
+/*
+ *This method is overridden to return a blank string always because this is
+ * a Complex Element. Instead of using this method, a user of a
+ * ComplexElement must get the childeren of this ComplexElement and
+ * has to traverse through the childrean in a appropriate manner
+ * in order to get there values.
+ */
+string& ComplexElement::getValue()
+{
+ return m_sValue;
+}
+
+/*
+ *This method is overridden to do nothing always because this is
+ * a Complex Element. Instead of using this method, a user of a
+ * ComplexElement must get the childeren of this ComplexElement and
+ * has to traverse through the childrean in a appropriate manner
+ * in order to set there values.
+ */
+int ComplexElement::setValue(string &sValue)
+{
+ return SUCCESS;
+}
1.3 +4 -1 xml-axis/c/src/soap/ComplexElement.h
Index: ComplexElement.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/ComplexElement.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComplexElement.h 15 Jul 2003 07:09:01 -0000 1.2
+++ ComplexElement.h 5 Aug 2003 08:18:55 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -81,6 +81,9 @@
class ComplexElement : public BasicNode
{
public:
+ int setValue(string& sValue);
+ string& getValue();
+ NODE_TYPE getNodeType();
int setURI(const string& sURI);
int serialize(SoapSerializer& pSZ);
int addChild(BasicNode* pBasicNode);
1.3 +50 -1 xml-axis/c/src/soap/HeaderBlock.cpp
Index: HeaderBlock.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/HeaderBlock.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HeaderBlock.cpp 15 Jul 2003 07:07:17 -0000 1.2
+++ HeaderBlock.cpp 5 Aug 2003 08:18:55 -0000 1.3
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -69,6 +69,7 @@
#include "SoapSerializer.h"
#include "../common/GDefine.h"
#include "BasicNode.h"
+#include "CharacterElement.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -138,6 +139,11 @@
if(iStatus==FAIL) {
break;
}
+
+ iStatus= serializeNamespaceDecl(pSZ);
+ if(iStatus==FAIL) {
+ break;
+ }
pSZ<< ">";
@@ -297,3 +303,46 @@
return SUCCESS;
}
*/
+
+int HeaderBlock::addNamespaceDecl(Attribute *pAttribute)
+{
+ m_namespaceDecls.push_back(pAttribute);
+
+ return SUCCESS;
+}
+
+int HeaderBlock::serializeNamespaceDecl(SoapSerializer &pSZ)
+{
+ list<Attribute*>::iterator itCurrNamespaceDecl= m_namespaceDecls.begin();
+
+ while(itCurrNamespaceDecl != m_namespaceDecls.end()) {
+ (*itCurrNamespaceDecl)->serialize(pSZ);
+ itCurrNamespaceDecl++;
+ }
+
+ return SUCCESS;
+}
+
+BasicNode* HeaderBlock::getFirstChild()
+{
+ list<BasicNode*>::iterator itCurrBasicNode= m_children.begin();
+
+ if (itCurrBasicNode != m_children.end()) {
+ return (*itCurrBasicNode);
+ }
+
+ return NULL;
+}
+
+BasicNode* HeaderBlock::createChild(NODE_TYPE eNODE_TYPE)
+{
+ BasicNode* pBasicNode;
+
+ if(eNODE_TYPE==CHARACTER_NODE) {
+ pBasicNode = new CharacterElement();
+ } else if (eNODE_TYPE==ELEMENT_NODE) {
+ //do some thing appropriate
+ }
+
+ return pBasicNode;
+}
1.6 +8 -2 xml-axis/c/src/soap/HeaderBlock.h
Index: HeaderBlock.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/HeaderBlock.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HeaderBlock.h 27 Jul 2003 06:56:39 -0000 1.5
+++ HeaderBlock.h 5 Aug 2003 08:18:55 -0000 1.6
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -109,6 +109,7 @@
{
private:
+ int serializeNamespaceDecl(SoapSerializer& pSZ);
int serializeChildren(SoapSerializer& pSZ);
//int serializeChildren(string& sSerialized);
list<BasicNode*> m_children;
@@ -119,11 +120,16 @@
string m_prefix;
string m_uri;
list<Attribute*> m_attributes;
+ list<Attribute*> m_namespaceDecls;
string m_value;
//string m_strSerialized;
public:
- int addChild(BasicNode* pBasicNode);
+ BasicNode* createChild(NODE_TYPE eNODE_TYPE);
+ BasicNode* getFirstChild();
+ int addNamespaceDecl(Attribute *pAttribute);
+ int addChild(BasicNode* pBasicNode);
+
int serialize(SoapSerializer& pSZ);
//int serialize(string&);
void setValue(const string &value);
1.4 +6 -2 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoapDeSerializer.cpp 21 Jul 2003 14:21:09 -0000 1.3
+++ SoapDeSerializer.cpp 5 Aug 2003 08:18:55 -0000 1.4
@@ -71,6 +71,7 @@
#include "SoapFault.h"
#include "SoapDeSerializer.h"
#include "../common/GDefine.h"
+class ISoapHeader;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -102,9 +103,12 @@
return m_pHandler->m_pEnv;
}
-SoapHeader* SoapDeSerializer::GetHeader()
+ISoapHeader* SoapDeSerializer::GetHeader()
{
- return m_pHandler->m_pHead;
+ //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);
}
SoapBody* SoapDeSerializer::GetBody()
1.6 +1 -1 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SoapDeSerializer.h 1 Aug 2003 14:34:53 -0000 1.5
+++ SoapDeSerializer.h 5 Aug 2003 08:18:55 -0000 1.6
@@ -95,7 +95,7 @@
SoapFault* GetFault();
SoapMethod* GetMethod();
SoapBody* GetBody();
- SoapHeader* GetHeader();
+ ISoapHeader* GetHeader();
SoapEnvelope* GetEnvelope();
int SetStream(InputSource* sStream);
SoapDeSerializer();
1.5 +18 -1 xml-axis/c/src/soap/SoapHeader.cpp
Index: SoapHeader.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapHeader.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SoapHeader.cpp 15 Jul 2003 07:05:06 -0000 1.4
+++ SoapHeader.cpp 5 Aug 2003 08:18:55 -0000 1.5
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -257,3 +257,20 @@
return SUCCESS;
}
*/
+
+IHeaderBlock* SoapHeader::getHeaderBlock()
+{
+ list<HeaderBlock*>::iterator itCurrHeaderBlock= m_headerBlocks.begin();
+
+ if(itCurrHeaderBlock != m_headerBlocks.end()) {
+
+ /*
+ *Actually a dynamic cast is not needed here. But it
+ * is done for safe side.
+ */
+ return dynamic_cast<IHeaderBlock*>(*itCurrHeaderBlock);
+ }
+
+ return NULL;
+
+}
1.5 +5 -2 xml-axis/c/src/soap/SoapHeader.h
Index: SoapHeader.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapHeader.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SoapHeader.h 15 Jul 2003 07:05:06 -0000 1.4
+++ SoapHeader.h 5 Aug 2003 08:18:55 -0000 1.5
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -74,6 +74,7 @@
#include "HeaderBlock.h"
#include "SoapEnvVersions.h"
+#include "../common/ISoapHeader.h"
/**
* The Header element information item according to SOAP 1.2 specification.
@@ -90,7 +91,7 @@
* @brief The Header element information item according to SOAP 1.2 specification
*/
-class SoapHeader
+class SoapHeader : public ISoapHeader
{
private:
int serializeNamespaceDecl(SoapSerializer& pSZ);
@@ -102,12 +103,14 @@
list<HeaderBlock*> m_headerBlocks;
//string m_strHeaderSerialized;
public:
+ IHeaderBlock* getHeaderBlock();
int addNamespaceDecl(Attribute* pAttribute);
int addAttribute(Attribute* pAttribute);
//string& serialize();
int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion);
//int serialize(string&, SOAP_VERSION eSoapVersion);
void addHeaderBlock(HeaderBlock* headerBlock);
+
SoapHeader();
virtual ~SoapHeader();
1.9 +2 -2 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SoapSerializer.h 5 Aug 2003 05:49:16 -0000 1.8
+++ SoapSerializer.h 5 Aug 2003 08:18:55 -0000 1.9
@@ -57,7 +57,7 @@
*
*
*
- * @author Roshan Weerasuriya (roshan@jkcs.slt.lk)
+ * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
*
*/
@@ -84,7 +84,7 @@
class SoapFault;
class HeaderBlock;
-class SoapSerializer : public virtual IWrapperSoapSerializer, public virtual IHandlerSoapSerializer /*: public ISoapSerializer*/
+class SoapSerializer : public IWrapperSoapSerializer, public IHandlerSoapSerializer /*: public ISoapSerializer*/
{
private:
static int iCounter;
1.5 +53 -1 xml-axis/c/src/soap/XMLStreamHandler.cpp
Index: XMLStreamHandler.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/XMLStreamHandler.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLStreamHandler.cpp 23 Jul 2003 10:04:45 -0000 1.4
+++ XMLStreamHandler.cpp 5 Aug 2003 08:18:55 -0000 1.5
@@ -67,6 +67,7 @@
#include "URIMapping.h"
#include "Attribute.h"
#include "SoapEnvVersions.h"
+#include "CharacterElement.h"
#define __TRC(X) XMLString::transcode(X)
#define __REL(X) XMLString::release(X)
@@ -150,6 +151,8 @@
break;
case SOAP_HEADER:
//Soap header entry
+ createHeaderBlock(uri, localname, qname, attrs);
+ m_PL1= SOAP_HEADER_BLOCK;
break;
case SOAP_FAULT:
//Soap fault sub element
@@ -200,13 +203,16 @@
}
}
-void XMLStreamHandler::endElement (const XMLCh *const uri,const XMLCh *const localname,const XMLCh *const qname)
+void XMLStreamHandler::endElement (const XMLCh *const uri,const XMLCh *const localname,const XMLCh *const qname)
{
char *pcLocalName = __TRC(localname);
if (pcLocalName) {
switch (m_PL1)
{
case SOAP_UNKNOWN:
+ if(m_PL0==SOAP_HEADER) {
+ m_PL0= SOAP_ENVELOP;
+ }
break;
case SOAP_METHOD: //end of method element
if (m_nParamNestingLevel == 0)
@@ -222,6 +228,12 @@
m_PL1 = SOAP_METHOD; //next parameter can be Nth parameter just within the Method element.
m_nParamNestingLevel--;
break;
+ case SOAP_HEADER_BLOCK: //enf of a HeaderBlock
+ //Add HeaderBlock to Header
+ m_pHead->addHeaderBlock(pHeaderBlock);
+
+ m_PL1= SOAP_UNKNOWN;
+ break;
default:
m_Success = FAIL;
}
@@ -241,6 +253,14 @@
m_Param.SetValue(str);
__REL(&value);
}
+ } else if ((m_PL0 == SOAP_HEADER) && (m_PL1 == SOAP_HEADER_BLOCK)) {
+ //Get the value of the header entry
+ char *value = __TRC(chars);
+ if(value) {
+ string str= value;
+ CharacterElement* pCharacterElement= new CharacterElement(str);
+ pHeaderBlock->addChild(pCharacterElement);
+ }
}
}
@@ -601,4 +621,36 @@
m_pMethod->addAttribute(pAttr);
}
*/
+}
+
+void XMLStreamHandler::createHeaderBlock(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
+{
+ pHeaderBlock= new HeaderBlock();
+ //pHeaderBlock->setPrefix("A");
+ //pHeaderBlock->setLocalName("A");
+ pHeaderBlock->setUri("A");
+
+
+ char* pc;
+ string str;
+ pc = __TRC(qname);
+ str = pc;
+ __REL(&pc);
+
+ if (str.find(':') != string::npos)
+ {
+ str = str.substr(0, str.find(':'));
+ pHeaderBlock->setPrefix(str);
+ }
+
+ pc = __TRC(localname);
+ str = pc;
+ __REL(&pc);
+ pHeaderBlock->setLocalName(str);
+
+ pc = __TRC(uri);
+ str = pc;
+ __REL(&pc);
+ pHeaderBlock->setUri(str);
+
}
1.3 +4 -1 xml-axis/c/src/soap/XMLStreamHandler.h
Index: XMLStreamHandler.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/XMLStreamHandler.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLStreamHandler.h 21 Jul 2003 14:21:09 -0000 1.2
+++ XMLStreamHandler.h 5 Aug 2003 08:18:55 -0000 1.3
@@ -94,7 +94,7 @@
XERCES_CPP_NAMESPACE_USE
-enum SOAP_PARSE_LEVEL { SOAP_UNKNOWN=1, SOAP_ENVELOP, SOAP_HEADER, SOAP_FAULT, SOAP_BODY, SOAP_METHOD, SOAP_PARAM};
+enum SOAP_PARSE_LEVEL { SOAP_UNKNOWN=1, SOAP_ENVELOP, SOAP_HEADER, SOAP_FAULT, SOAP_BODY, SOAP_METHOD, SOAP_PARAM, SOAP_HEADER_BLOCK};
class XMLStreamHandler:public DefaultHandler
{
@@ -122,7 +122,10 @@
SOAP_PARSE_LEVEL m_PL1;
SOAP_PARSE_LEVEL m_PL2;
string m_sLastElement;
+
+ HeaderBlock* pHeaderBlock;
private:
+ void createHeaderBlock(const XMLCh *const uri,const XMLCh *const localname,const XMLCh *const qname,const Attributes &attrs);
int m_nParamNestingLevel;
int SetArrayDimensions(string& sDimensions);
void FillMethod(const XMLCh *const uri,const XMLCh *const localname,const XMLCh *const qname,const Attributes &attrs);