Author: nadiramra
Date: Sun Aug 7 21:27:30 2011
New Revision: 1154771
URL: http://svn.apache.org/viewvc?rev=1154771&view=rev
Log:
Stage 1 for AXISCPP-712 and AXISCPP-1081, ability to add attributes to SOAP
header and SOAP body.
Modified:
axis/axis1/c/trunk/src/soap/Attribute.cpp
axis/axis1/c/trunk/src/soap/HeaderBlock.cpp
axis/axis1/c/trunk/src/soap/SoapBody.cpp
axis/axis1/c/trunk/src/soap/SoapBody.h
axis/axis1/c/trunk/src/soap/SoapEnvelope.cpp
axis/axis1/c/trunk/src/soap/SoapHeader.cpp
axis/axis1/c/trunk/src/soap/SoapHeader.h
axis/axis1/c/trunk/src/soap/SoapSerializer.cpp
axis/axis1/c/trunk/src/soap/SoapSerializer.h
Modified: axis/axis1/c/trunk/src/soap/Attribute.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/Attribute.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/Attribute.cpp (original)
+++ axis/axis1/c/trunk/src/soap/Attribute.cpp Sun Aug 7 21:27:30 2011
@@ -15,20 +15,6 @@
* limitations under the License.
*/
-/*
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- *
- *
- *
- * @author Roshan Weerasuriya ([email protected], [email protected])
- * @author Samisa Abeysinghe ([email protected])
- *
- */
-
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -188,9 +174,7 @@ Attribute(list<Attribute*> attribute,
}
if( prefix != NULL && strlen( prefix) > 0)
- {
m_PrefixList.push_back( prefix);
- }
}
Attribute::
@@ -223,8 +207,7 @@ Attribute(list<Attribute*> attribute,
}
Attribute::
-Attribute(list<Attribute*> attribute,
- const Attribute& rCopy)
+Attribute(list<Attribute*> attribute, const Attribute& rCopy)
{
this->m_localname= rCopy.m_localname;
this->m_prefix= rCopy.m_prefix;
@@ -274,9 +257,7 @@ serialize(SoapSerializer& pSZ) const
}
int Attribute::
-serialize(SoapSerializer& pSZ,
- list<AxisChar*>& lstTmpNameSpaceStack,
- const AxisChar *uri)
+serialize(SoapSerializer& pSZ, list<AxisChar*>& lstTmpNameSpaceStack, const
AxisChar *uri)
{
int intStatus= AXIS_FAIL;
@@ -284,25 +265,36 @@ serialize(SoapSerializer& pSZ,
{
pSZ.serialize(" ", NULL);
+ // There should be no determination if a prefix exists or not, simply
because a user
+ // can choose to add the namespace declaration to a node after the
attribute has been
+ // added to the node.
if (m_prefix.compare("xmlns") == 0)
{
- // Namespace declaration...
+ // Namespace declaration...this code could be eliminated since
next if-check takes
+ // care of this, but it was thought it would be good to show that
the prefix
+ // can really be a namespace declaration.
+
pSZ.serialize("xmlns:", m_localname.c_str(), "=",
PLATFORM_DOUBLE_QUOTE_S, m_value.c_str(), PLATFORM_DOUBLE_QUOTE_S, NULL);
+
intStatus= AXIS_SUCCESS;
}
- else if ((!pSZ.getNamespaceURL( m_prefix).empty() || NULL!=uri))
+ else if (!m_prefix.empty())
{
- /*
- * If User has provided the prefix we just have to serialize. We
will
- * not worry to declare the namespace at all. Because it is the
users
- * responsibility to add namespace declaration separately.
- * However, if user hasn't provided the prefix. So we have to do
the following.
- * - get the prefix from the Serializer
- * - if this is a new namespace, then also declare the namespace.
- */
- if(!m_prefix.empty() || NULL!=uri)
- pSZ.serialize(m_prefix.c_str(), ":", NULL);
- else if (!m_uri.empty())
+ // If User has provided the prefix we just have to serialize. We
will
+ // not worry to declare the namespace at all. Because it is the
user's
+ // responsibility to add namespace declaration separately.
+
+ pSZ.serialize(m_prefix.c_str(), ":", m_localname.c_str(), "=",
PLATFORM_DOUBLE_QUOTE_S, m_value.c_str(), PLATFORM_DOUBLE_QUOTE_S, NULL);
+
+ intStatus= AXIS_SUCCESS;
+ }
+ else
+ {
+ // User hasn't provided the prefix. So if there is a URI, do the
following.
+ // - get the prefix from the Serializer
+ // - if this is a new namespace, then also declare the namespace.
+
+ if (!m_uri.empty())
{
bool blnIsNewNamespace = false;
m_prefix = pSZ.getNamespacePrefix(m_uri.c_str(),
blnIsNewNamespace);
Modified: axis/axis1/c/trunk/src/soap/HeaderBlock.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/HeaderBlock.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/HeaderBlock.cpp (original)
+++ axis/axis1/c/trunk/src/soap/HeaderBlock.cpp Sun Aug 7 21:27:30 2011
@@ -15,19 +15,6 @@
* limitations under the License.
*/
-/*
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- *
- *
- *
- * @author Roshan Weerasuriya ([email protected], [email protected])
- *
- */
-
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -246,6 +233,7 @@ serialize(SoapSerializer& pSZ)
list<AxisChar*> lstTmpNameSpaceStack;
bool blnIsNewNamespace = false;
+ bool bResetPrefix = false;
do
{
@@ -257,18 +245,19 @@ serialize(SoapSerializer& pSZ)
m_sPrefix = pSZ.getNamespacePrefix(m_uri.c_str(),
blnIsNewNamespace);
if (blnIsNewNamespace)
lstTmpNameSpaceStack.push_back((AxisChar*)m_uri.c_str());
+ bResetPrefix = true;
}
else
{
// new namespace and will be declared as a namespace declaration.
blnIsNewNamespace = true;
- /* Adding to the Serializers namespace list b'cas the child
+ /* Adding to the Serializer namespace list because the child
elements of this HeaderBlock might use this namespace, so that they
- can get the correct corrosponding prefix from the Serializer.
+ can get the correct corresponding prefix from the Serializer.
*/
pSZ.addNamespaceToNamespaceList(m_uri.c_str(), m_sPrefix.c_str());
- /* Adding this namespace to the temprory namespace list b'cas we
- have to remove this namespce from the Serializer at the end of this
+ /* Adding this namespace to the temporary namespace list because we
+ have to remove this namespace from the Serializer at the end of
this
HeaderBlock serialization.
*/
lstTmpNameSpaceStack.push_back((AxisChar*)m_uri.c_str());
@@ -306,7 +295,8 @@ serialize(SoapSerializer& pSZ)
}
while(0);
- m_sPrefix = "";
+ if (bResetPrefix)
+ m_sPrefix = "";
logExitWithReturnCode(iStatus)
Modified: axis/axis1/c/trunk/src/soap/SoapBody.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapBody.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapBody.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapBody.cpp Sun Aug 7 21:27:30 2011
@@ -48,6 +48,8 @@ SoapBody::
delete m_pSoapMethod;
delete m_pSoapFault;
+ clear();
+
logExit()
}
@@ -83,6 +85,8 @@ serialize(SoapSerializer& pSZ, SOAP_VERS
pSZ.serialize("<", gs_SoapEnvVersionsStruct[eSoapVersion].pchPrefix,
":", gs_SoapEnvVersionsStruct[eSoapVersion].pchWords[SKW_BODY],
NULL);
+
+ iStatus= serializeNamespaceDecl(pSZ);
iStatus= serializeAttributes(pSZ);
if(iStatus==AXIS_FAIL)
break;
@@ -161,5 +165,87 @@ serializeAttributes(SoapSerializer& pSZ)
return iStatus;
}
+
+int SoapBody::
+addNamespaceDecl(Attribute *pAttribute)
+{
+ logEntryEngine("SoapBody::addNamespaceDecl")
+
+ int iStatus = AXIS_FAIL;
+
+ if (pAttribute)
+ {
+ m_namespaceDecls.push_back(pAttribute);
+ iStatus = AXIS_SUCCESS;
+ }
+
+ logExitWithReturnCode(iStatus)
+
+ return iStatus;
+}
+
+
+int SoapBody::
+serializeNamespaceDecl(SoapSerializer& pSZ)
+{
+ logEntryEngine("SoapBody::serializeNamespaceDecl")
+
+ list<Attribute*>::iterator itCurrNamespaceDecl= m_namespaceDecls.begin();
+
+ while(itCurrNamespaceDecl != m_namespaceDecls.end())
+ {
+ (*itCurrNamespaceDecl)->serialize(pSZ);
+ itCurrNamespaceDecl++;
+ }
+
+ logExitWithReturnCode(AXIS_SUCCESS)
+
+ return AXIS_SUCCESS;
+}
+
+
+void SoapBody::
+clearAttributes()
+{
+ logEntryEngine("SoapBody::clearAttributes")
+
+ list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
+ while(itCurrAttribute != m_attributes.end())
+ {
+ delete *itCurrAttribute;
+ itCurrAttribute++;
+ }
+ m_attributes.clear();
+
+ logExit()
+}
+
+void SoapBody::
+clearNamespaceDecls()
+{
+ logEntryEngine("SoapBody::clearNamespaceDecls")
+
+ list<Attribute*>::iterator itCurrNamespaceDecl= m_namespaceDecls.begin();
+ while(itCurrNamespaceDecl != m_namespaceDecls.end())
+ {
+ delete *itCurrNamespaceDecl;
+ itCurrNamespaceDecl++;
+ }
+ m_namespaceDecls.clear();
+
+ logExit()
+}
+
+void SoapBody::
+clear()
+{
+ logEntryEngine("SoapBody::clear")
+
+ clearAttributes();
+ clearNamespaceDecls();
+
+ logExit()
+}
+
AXIS_CPP_NAMESPACE_END
Modified: axis/axis1/c/trunk/src/soap/SoapBody.h
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapBody.h?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapBody.h (original)
+++ axis/axis1/c/trunk/src/soap/SoapBody.h Sun Aug 7 21:27:30 2011
@@ -57,8 +57,6 @@ class Attribute;
* - encodingStyle attribute information item
* SOAP defines one particular direct child of the SOAP body, the SOAP fault,
which is used for reporting
* errors
- *
- * @author Roshan Weerasuriya ([email protected])
*/
class SoapBody
@@ -67,20 +65,69 @@ friend class SoapSerializer;
private:
int serializeAttributes(SoapSerializer& pSZ);
+ int serializeNamespaceDecl(SoapSerializer& pSZ);
+
list<Attribute*> m_attributes;
+ list<Attribute*> m_namespaceDecls;
SoapMethod *m_pSoapMethod;
SoapFault *m_pSoapFault;
public:
+ /**
+ * Add attribute to the SOAP body.
+ *
+ * @param attr The Attribute pointer which points to an attribute.
+ */
void addAttribute(Attribute* attr);
+
+ /**
+ * Sets the namespace declaration of the Soap body. Object will be owned
by the class.
+ *
+ * @param pAttribute The Attribute pointer which points to a valid
namespace declaration Attribute.
+ * @return AXIS_SUCCESS to indicate successfull operation. Return
AXIS_FAIL to indicate unsuccessfull operation.
+ */
+ int addNamespaceDecl(Attribute* pAttribute);
+
+ /**
+ * Serialize SOAP body.
+ */
int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion);
+
void setSoapFault(SoapFault* pSoapFault);
void setSoapMethod(SoapMethod* ptrSoapMethod);
+
+ /**
+ * Constructor.
+ */
SoapBody();
+
+ /**
+ * Destructor.
+ */
virtual ~SoapBody();
+ /**
+ * Returns SoapMethod.
+ */
SoapMethod *getSoapMethod() { return m_pSoapMethod; }
+
+ /**
+ * Clears all previously set information by calling
+ * clearAttributes() and clearNamespaceDecls().
+ */
+ void clear();
+
+ /**
+ * Clears any attributes by actually deleting the objects representing the
attributes.
+ */
+ void clearAttributes();
+
+ /**
+ * Clears any namespace declarations by deleting the objects representing
the namespace
+ * declarations.
+ */
+ void clearNamespaceDecls();
};
AXIS_CPP_NAMESPACE_END
Modified: axis/axis1/c/trunk/src/soap/SoapEnvelope.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapEnvelope.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapEnvelope.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapEnvelope.cpp Sun Aug 7 21:27:30 2011
@@ -13,11 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/*
- * @author Roshan Weerasuriya ([email protected])
- * @author Samisa Abeysinghe ([email protected])
- */
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -275,6 +270,7 @@ reset()
if (m_pSoapBody)
{
+ m_pSoapBody->clear();
SoapMethod * soapMethod = m_pSoapBody->getSoapMethod();
if ( soapMethod )
soapMethod->clearOutParams();
Modified: axis/axis1/c/trunk/src/soap/SoapHeader.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapHeader.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapHeader.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapHeader.cpp Sun Aug 7 21:27:30 2011
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-/*
- * @author Roshan Weerasuriya ([email protected], [email protected])
- */
-
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -48,21 +44,7 @@ SoapHeader::
{
logEntryEngine("SoapHeader::~SoapHeader")
- // Header blocks are not deleted here any more. Its the responsibility of
- // either a handler or stub etc to delete any header block created by them
- // Here we will just clear the list of header block pointers
- m_headerBlocks.clear();
-
- // deletion of attributes
- list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
-
- while(itCurrAttribute != m_attributes.end())
- {
- delete *itCurrAttribute;
- itCurrAttribute++;
- }
-
- m_attributes.clear();
+ clear();
logExit()
}
@@ -89,7 +71,7 @@ serialize(SoapSerializer& pSZ, SOAP_VERS
do
{
- if (0 == m_headerBlocks.size())
+ if (0 == m_headerBlocks.size() && 0 == m_namespaceDecls.size() && 0 ==
m_attributes.size())
break;
pSZ.serialize("<", gs_SoapEnvVersionsStruct[eSoapVersion].pchPrefix,
@@ -343,25 +325,62 @@ deleteHeaderBlock(const AxisChar *pName,
}
void SoapHeader::
-clear()
+clearHeaderBlocks()
{
- logEntryEngine("SoapHeader::clear")
+ logEntryEngine("SoapHeader::clearHeaderBlocks")
// Header blocks are not deleted here. Its the responsibility of
- // either a handler or stub etc to delete any header block created by them
- // Here we will just clear the list of header block pointers
+ // either a handler or stub etc to delete any header block created by them.
+ // Here we will just clear the list of header block pointers.
+ // The thought was that header blocks take some effort to create and thus
+ // why should user recreate every time a request is issued.
m_headerBlocks.clear();
- // deletion of attributes
- list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
+ logExit()
+}
+void SoapHeader::
+clearAttributes()
+{
+ logEntryEngine("SoapHeader::clearAttributes")
+
+ // Deletion of attributes - strange, i know, that we delete attributes but
not header blocks...
+ // I guess the thought is that attributes are easy to recreate.
+ list<Attribute*>::iterator itCurrAttribute= m_attributes.begin();
while(itCurrAttribute != m_attributes.end())
{
delete *itCurrAttribute;
itCurrAttribute++;
}
-
m_attributes.clear();
+
+ logExit()
+}
+
+void SoapHeader::
+clearNamespaceDecls()
+{
+ logEntryEngine("SoapHeader::clearNamespaceDecls")
+
+ list<Attribute*>::iterator itCurrNamespaceDecl= m_namespaceDecls.begin();
+ while(itCurrNamespaceDecl != m_namespaceDecls.end())
+ {
+ delete *itCurrNamespaceDecl;
+ itCurrNamespaceDecl++;
+ }
+ m_namespaceDecls.clear();
+
+ logExit()
+}
+
+void SoapHeader::
+clear()
+{
+ logEntryEngine("SoapHeader::clear")
+
+ clearHeaderBlocks();
+ clearAttributes();
+ clearNamespaceDecls();
logExit()
}
Modified: axis/axis1/c/trunk/src/soap/SoapHeader.h
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapHeader.h?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapHeader.h (original)
+++ axis/axis1/c/trunk/src/soap/SoapHeader.h Sun Aug 7 21:27:30 2011
@@ -18,10 +18,22 @@
#if !defined(_SOAPHEADER_H____OF_AXIS_INCLUDED_)
#define _SOAPHEADER_H____OF_AXIS_INCLUDED_
+#include "Attribute.h"
+#include "HeaderBlock.h"
+#include <list>
+using namespace std;
+
+typedef enum
+{
+ HEADER_LEVEL=0, HEADER_BLOCK_LEVEL, HEADER_BLOCK_INSIDE_LEVEL
+} HEADER_LEVELS;
+
+AXIS_CPP_NAMESPACE_START
+class Attribute;
+
/**
* @class SoapHeader
- * @brief The Header element information item according to SOAP
- * 1.2 specification
+ * @brief The Header element information item according to SOAP 1.2
specification
*
* The Header element information item according to SOAP 1.2 specification.
* The Header element information item has:
@@ -32,26 +44,10 @@
* 4) Zero or more namespace qualified element information items
* in its [children] property.
*
- * Each child element information item of the SOAP Header is called
- * a SOAP header block.
- *
+ * Each child element information item of the SOAP Header is called a SOAP
header block.
*
- * @author Roshan Weerasuriya ([email protected], [email protected])
*/
-#include "Attribute.h"
-#include "HeaderBlock.h"
-#include <list>
-using namespace std;
-
-typedef enum
-{
- HEADER_LEVEL=0, HEADER_BLOCK_LEVEL, HEADER_BLOCK_INSIDE_LEVEL
-} HEADER_LEVELS;
-
-AXIS_CPP_NAMESPACE_START
-class Attribute;
-
class SoapHeader
{
private:
@@ -77,8 +73,7 @@ public:
* the requested Header Block is found, also it will be removed from the
* list of Header Blocks of this Soap Header, before returning a pointer.
*/
- IHeaderBlock* getHeaderBlock(const AxisChar* pName,
- const AxisChar* pNamespace, bool bRemoveOrNot);
+ IHeaderBlock* getHeaderBlock(const AxisChar* pName, const AxisChar*
pNamespace, bool bRemoveOrNot);
/**
* Returns the first header block
@@ -105,7 +100,7 @@ public:
IHeaderBlock* getHeaderBlock(bool bRemoveOrNot);
/**
- * Sets the namespace declaration of the Soap Header.
+ * Sets the namespace declaration of the Soap Header. Object will be
owned by the class.
*
* @param pAttribute The Attribute pointer which points to a valid
* namespace declartion Attribute.
@@ -115,7 +110,7 @@ public:
int addNamespaceDecl(Attribute* pAttribute);
/**
- * Adds a Attribute to this Soap Header.
+ * Adds a Attribute to this Soap Header. Object will be owned by the
class.
*
* @param attr The Attribute to be added.
* @return AXIS_SUCCESS to indicate successfull operation. Return
@@ -123,23 +118,23 @@ public:
*/
int addAttribute(Attribute* pAttribute);
+ /**
+ * Serialize the SOAP header.
+ */
int serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion);
/**
- * Adds a Header Block to this Soap Header.
+ * Adds a Header Block to this Soap Header. Note that the object is still
owned
+ * by the caller and will not be deleted by this class.
*
* @param headerBlock The Header Block to be added.
*/
void addHeaderBlock(IHeaderBlock* headerBlock);
/**
- * Deletes a header block.
- *
- *
+ * Removes a header block from the header block list.
*/
-
- int deleteHeaderBlock(const AxisChar *pName,
- const AxisChar *pNamespace);
+ int deleteHeaderBlock(const AxisChar *pName, const AxisChar *pNamespace);
/**
* The Constructor.
@@ -151,7 +146,28 @@ public:
*/
virtual ~SoapHeader();
+ /**
+ * Clears all previously set information by calling clearHeaderBlocks(),
+ * clearAttributes(), and clearNamespaceDecls().
+ */
void clear();
+
+ /**
+ * Clears header blocks. Note that the header blocks are not deleted, just
cleared from
+ * the instance.
+ */
+ void clearHeaderBlocks();
+
+ /**
+ * Clears any attributes by actually deleting the objects representing the
attributes.
+ */
+ void clearAttributes();
+
+ /**
+ * Clears any namespace declarations by deleting the objects representing
the namespace
+ * declarations.
+ */
+ void clearNamespaceDecls();
};
AXIS_CPP_NAMESPACE_END
#endif
Modified: axis/axis1/c/trunk/src/soap/SoapSerializer.cpp
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapSerializer.cpp?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapSerializer.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapSerializer.cpp Sun Aug 7 21:27:30 2011
@@ -15,13 +15,6 @@
* limitations under the License.
*/
-/*
- * @author Roshan Weerasuriya ([email protected], [email protected])
- * @author Susantha Kumara ([email protected], [email protected])
- * @author Damitha Kumarage ([email protected], [email protected])
- *
- */
-
// !!! This include file must be first thing in file !!!
#include "../platforms/PlatformAutoSense.hpp"
@@ -1600,4 +1593,120 @@ reset()
logExit()
}
+
+void SoapSerializer::
+addNamespaceToSOAPHeader(const AxisChar *pachNamespaceURI, const AxisChar*
pachPrefix)
+{
+ logEntryEngine("SoapSerializer::addNamespaceToSOAPHeader")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapHeader)
+ {
+ std::list<Attribute*> attributeList;
+ Attribute * pAttribute = new Attribute( attributeList, pachPrefix,
"xmlns", pachNamespaceURI);
+
+ m_pSoapEnvelope->m_pSoapHeader->addNamespaceDecl(pAttribute);
+ }
+
+ logExit()
+}
+
+void SoapSerializer::
+addAttributeToSOAPHeader(const AxisChar *pLocalname, const AxisChar *pPrefix,
const AxisChar *pValue)
+{
+ logEntryEngine("SoapSerializer::addAttributeToSOAPHeader")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapHeader)
+ {
+ std::list<Attribute*> attributeList;
+ Attribute * pAttribute = new Attribute( attributeList, pLocalname,
pPrefix, pValue);
+
+ m_pSoapEnvelope->m_pSoapHeader->addAttribute(pAttribute);
+ }
+
+ logExit()
+}
+
+void SoapSerializer::
+clearSOAPHeaderAttributes()
+{
+ logEntryEngine("SoapSerializer::clearSOAPHeaderAttributes")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapHeader)
+ m_pSoapEnvelope->m_pSoapHeader->clearAttributes();
+
+ logExit()
+}
+
+void SoapSerializer::
+clearSOAPHeaderNamespaces()
+{
+ logEntryEngine("SoapSerializer::clearSOAPHeaderNamespaces")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapHeader)
+ m_pSoapEnvelope->m_pSoapHeader->clearNamespaceDecls();
+
+ logExit()
+}
+
+void SoapSerializer::
+addNamespaceToSOAPBody(const AxisChar *pachNamespaceURI, const AxisChar*
pachPrefix)
+{
+ logEntryEngine("SoapSerializer::addNamespaceToSOAPBody")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapBody)
+ {
+ std::list<Attribute*> attributeList;
+ Attribute * pAttribute = new Attribute( attributeList, pachPrefix,
"xmlns", pachNamespaceURI);
+
+ m_pSoapEnvelope->m_pSoapBody->addNamespaceDecl(pAttribute);
+ }
+
+ logExit()
+}
+
+void SoapSerializer::
+addAttributeToSOAPBody(const AxisChar *pLocalname, const AxisChar *pPrefix,
const AxisChar *pValue)
+{
+ logEntryEngine("SoapSerializer::addAttributeToSOAPBody")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapBody)
+ {
+ std::list<Attribute*> attributeList;
+ Attribute * pAttribute = new Attribute( attributeList, pLocalname,
pPrefix, pValue);
+
+ m_pSoapEnvelope->m_pSoapBody->addAttribute(pAttribute);
+ }
+
+ logExit()
+}
+
+void SoapSerializer::
+clearSOAPBodyAttributes()
+{
+ logEntryEngine("SoapSerializer::clearSOAPBodyAttributes")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapBody)
+ m_pSoapEnvelope->m_pSoapBody->clearAttributes();
+
+ logExit()
+}
+
+void SoapSerializer::
+clearSOAPBodyNamespaces()
+{
+ logEntryEngine("SoapSerializer::clearSOAPBodyNamespaces")
+
+ if (m_pSoapEnvelope
+ && m_pSoapEnvelope->m_pSoapBody)
+ m_pSoapEnvelope->m_pSoapBody->clearNamespaceDecls();
+
+ logExit()
+}
AXIS_CPP_NAMESPACE_END
Modified: axis/axis1/c/trunk/src/soap/SoapSerializer.h
URL:
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapSerializer.h?rev=1154771&r1=1154770&r2=1154771&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapSerializer.h (original)
+++ axis/axis1/c/trunk/src/soap/SoapSerializer.h Sun Aug 7 21:27:30 2011
@@ -46,11 +46,6 @@ class SoapAttachmentReference;
/**
* @class SoapSerializer
* @brief interface for the SoapSerializer class.
- *
- *
- *
- * @author Roshan Weerasuriya ([email protected], [email protected])
- * @author Susantha Kumara ([email protected], [email protected])
*/
class SoapSerializer : public IHandlerSoapSerializer
@@ -188,12 +183,9 @@ public:
int setSOAPMethodAttribute(Attribute* pAttribute);
void clearSOAPMethodAttributes();
SoapMethod* getSOAPMethod();
- IHeaderBlock* createHeaderBlock(const AxisChar *pachLocalName,
- const AxisChar *pachUri);
- /* to add a header block to the Serializer. Probably by a handler */
+ IHeaderBlock* createHeaderBlock(const AxisChar *pachLocalName, const
AxisChar *pachUri);
int AXISCALL addHeaderBlock(IHeaderBlock* pBlk);
- int AXISCALL addOutputParam(const AxisChar* pchName,
- void* pValue, XSDTYPE type);
+ int AXISCALL addOutputParam(const AxisChar* pchName, void* pValue, XSDTYPE
type);
int AXISCALL serializeAsElement(const AxisChar* pchName,
void* pValue,
XSDTYPE type);
@@ -215,8 +207,7 @@ public:
IAnySimpleType* pSimpleType);
void AXISCALL serializeVargs(const char * pFirst, va_list vList);
void AXISCALL serialize(const char* pFirst, ...);
- void setStyle(AXIS_BINDING_STYLE nStyle)
- { m_nStyle = nStyle; m_BTSZ.setStyle(nStyle);};
+ void setStyle(AXIS_BINDING_STYLE nStyle) { m_nStyle = nStyle;
m_BTSZ.setStyle(nStyle);};
AXIS_BINDING_STYLE getStyle(){return m_nStyle;};
int AXISCALL setBodyAsHexBinary(xsd__hexBinary body);
int AXISCALL setBodyAsBase64Binary(xsd__base64Binary body);
@@ -228,10 +219,51 @@ public:
int deleteHeaderBlock(const AxisChar* pName, const AxisChar* pNamespace);
/**
- * This methos will clear up all the current out params in preperation of a
+ * This method will clear up all the current out parameters in preparation
of a
* new method call
*/
void reset();
+
+ /**
+ * Add namespace to SOAP header.
+ */
+ void addNamespaceToSOAPHeader(const AxisChar *pachNamespaceURI, const
AxisChar* pachPrefix);
+
+ /**
+ * Clear SOAP header namespaces.
+ */
+ void clearSOAPHeaderNamespaces();
+
+ /**
+ * Add attribute to SOAP header.
+ */
+ void addAttributeToSOAPHeader(const AxisChar *pLocalname, const AxisChar
*pPrefix, const AxisChar *pValue);
+
+ /**
+ * Clear SOAP header attributes.
+ */
+ void clearSOAPHeaderAttributes();
+
+ /**
+ * Add namespace to SOAP body.
+ */
+ void addNamespaceToSOAPBody(const AxisChar *pachNamespaceURI, const
AxisChar* pachPrefix);
+
+ /**
+ * Clear SOAP body namespaces.
+ */
+ void clearSOAPBodyNamespaces();
+
+ /**
+ * Add attribute to SOAP body.
+ */
+ void addAttributeToSOAPBody(const AxisChar *pLocalname, const AxisChar
*pPrefix, const AxisChar *pValue);
+
+ /**
+ * Clear SOAP body attributes.
+ */
+ void clearSOAPBodyAttributes();
+
};
AXIS_CPP_NAMESPACE_END