You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ro...@apache.org on 2005/01/06 06:21:53 UTC
cvs commit: ws-axis/c/src/engine/client Call.cpp Stub.cpp
roshan 2005/01/05 21:21:52
Modified: c/src/soap HeaderBlock.cpp HeaderBlock.h SoapSerializer.cpp
SoapSerializer.h
c/include/axis/client Call.hpp Stub.hpp
c/src/engine/client Call.cpp Stub.cpp
Log:
fixed JIRA issue AXISCPP-356
Revision Changes Path
1.43 +25 -2 ws-axis/c/src/soap/HeaderBlock.cpp
Index: HeaderBlock.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/HeaderBlock.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- HeaderBlock.cpp 5 Jan 2005 10:39:02 -0000 1.42
+++ HeaderBlock.cpp 6 Jan 2005 05:21:52 -0000 1.43
@@ -210,7 +210,23 @@
{
lstTmpNameSpaceStack.push_back((AxisChar*)m_uri.c_str());
}
- }
+ } else {
+ /* The use has specified his/her own prefix. Therefore this is
+ taken as a new namespace and will be declared as a namespace
+ declaration.
+ */
+ blnIsNewNamespace = true;
+ /* Adding to the Serializers namespace list b'cas the child
+ elements of this HeaderBlock might use this namespace, so that they
+ can get the correct corrosponding 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
+ HeaderBlock serialization.
+ */
+ lstTmpNameSpaceStack.push_back((AxisChar*)m_uri.c_str());
+ }
pSZ.serialize(m_sPrefix.c_str(), ":", m_localname.c_str(), NULL);
@@ -733,5 +749,12 @@
return NULL;
}
-AXIS_CPP_NAMESPACE_END
+HeaderBlock::HeaderBlock(const AxisChar *pachLocalName, const AxisChar *pachUri, const AxisChar *pachPrefix)
+{
+ iNoOFChildren = 0;
+ m_localname = pachLocalName;
+ m_uri = pachUri;
+ m_sPrefix = pachPrefix;
+}
+AXIS_CPP_NAMESPACE_END
\ No newline at end of file
1.23 +10 -2 ws-axis/c/src/soap/HeaderBlock.h
Index: HeaderBlock.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/HeaderBlock.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- HeaderBlock.h 3 Jan 2005 06:06:21 -0000 1.22
+++ HeaderBlock.h 6 Jan 2005 05:21:52 -0000 1.23
@@ -92,7 +92,7 @@
std::list<Attribute*> m_attributes;
std::list<Attribute*> m_namespaceDecls;
-public:
+public:
/**
* Creates a Attribute and adds it to this Header Block as a namespace.
@@ -352,11 +352,19 @@
*/
int addNamespaceDecl(IAttribute *pAttribute);
- /**
+ /**
* The Constructor.
*
* @param pachLocalName The local name of this Header Block.
* @param pachPrefix The prefix of this Header Block.
+ * @param pachUri The namespace uri of this Header Block.
+ */
+ HeaderBlock(const AxisChar *pachLocalName, const AxisChar *pachUri, const AxisChar *pachPrefix);
+
+ /**
+ * The Constructor.
+ *
+ * @param pachLocalName The local name of this Header Block.
* @param pachUri The namespace uri of this Header Block.
*/
HeaderBlock(const AxisChar* pachLocalName, const AxisChar* pachUri);
1.82 +1 -1 ws-axis/c/src/soap/SoapSerializer.cpp
Index: SoapSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- SoapSerializer.cpp 5 Jan 2005 10:39:02 -0000 1.81
+++ SoapSerializer.cpp 6 Jan 2005 05:21:52 -0000 1.82
@@ -968,7 +968,7 @@
}
-void SoapSerializer::addNamespaceToNamespaceList(AxisChar *pachNamespaceURI, AxisChar* pachPrefix)
+void SoapSerializer::addNamespaceToNamespaceList(const AxisChar *pachNamespaceURI, const AxisChar* pachPrefix)
{
m_NsStack[pachNamespaceURI] = pachPrefix;
}
1.34 +1 -1 ws-axis/c/src/soap/SoapSerializer.h
Index: SoapSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- SoapSerializer.h 5 Jan 2005 10:39:02 -0000 1.33
+++ SoapSerializer.h 6 Jan 2005 05:21:52 -0000 1.34
@@ -155,7 +155,7 @@
BasicTypeSerializer m_BTSZ;
SOAPTransport* m_pOutputStream;
public:
- void addNamespaceToNamespaceList(AxisChar *pachNamespaceURI, AxisChar* pachPrefix);
+ void addNamespaceToNamespaceList(const AxisChar *pachNamespaceURI, const AxisChar* pachPrefix);
void addNamespaceToEnvelope(AxisChar *pachNamespaceURI, AxisChar* pachPrefix);
void addAttachmentBody(const AxisChar* achId, xsd__base64Binary* pAttchBody);
void addAttachmentHeader(const AxisChar* achId, const AxisChar* achHeaderName, const AxisChar* achHeaderValue);
1.14 +5 -0 ws-axis/c/include/axis/client/Call.hpp
Index: Call.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Call.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Call.hpp 17 Dec 2004 11:49:44 -0000 1.13
+++ Call.hpp 6 Jan 2005 05:21:52 -0000 1.14
@@ -223,6 +223,9 @@
virtual IHeaderBlock* AXISCALL createHeaderBlock(AxisChar *pachLocalName,
AxisChar *pachUri)=0;
+ virtual IHeaderBlock* AXISCALL createHeaderBlock(AxisChar *pachLocalName,
+ AxisChar *pachUri, AxisChar *pachPrefix)=0;
+
static bool bInitialized;
};
@@ -263,6 +266,8 @@
public:
IHeaderBlock* AXISCALL createHeaderBlock(AxisChar *pachLocalName,
AxisChar *pachUri);
+ IHeaderBlock* AXISCALL createHeaderBlock(AxisChar *pachLocalName,
+ AxisChar *pachUri, AxisChar *pachPrefix);
IHeaderBlock* createHeaderBlock();
/* Methods used by stubs to get a deserialized value of XML element
* as basic types
1.11 +75 -4 ws-axis/c/include/axis/client/Stub.hpp
Index: Stub.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Stub.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Stub.hpp 20 Dec 2004 08:35:09 -0000 1.10
+++ Stub.hpp 6 Jan 2005 05:21:52 -0000 1.11
@@ -54,10 +54,17 @@
*/
/*
- * Revision 1.13 2004/06/13 susantha
+ * Revision 1.7 2004/06/13 susantha
* Added support for writing C web services and handlers
*/
+/*
+ * Revision 1.8 2005/01/06 roshan
+ * Added the method:
+ * IHeaderBlock* createSOAPHeaderBlock(AxisChar * pachLocalName,
+ * AxisChar * pachUri, AxisChar * pachPrefix);
+ */
+
#if !defined(_STUB_H____OF_AXIS_INCLUDED_)
#define _STUB_H____OF_AXIS_INCLUDED_
@@ -88,6 +95,7 @@
class STORAGE_CLASS_INFO Stub
{
public:
+
/**
* Constructor.
*
@@ -394,8 +402,71 @@
* </PRE>
* the following code segment coule be used
* <PRE>
- * IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", "th",
+ * IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
* "http://ws.apache.org/axisCppTest/");
+ * //Note: The prefix will be added automaticaly.
+ * //create parent node
+ * BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
+ * parentNode->setLocalName("Credentials");
+ * //create child node
+ * BasicNode *childNode = phb->createChild(ELEMENT_NODE);
+ * childNode->setLocalName("username");
+ * //create char node for value
+ * BasicNode *valueNode = phb->createChild(CHARACTER_NODE);
+ * valueNode->setValue("Test User");
+ * //buld node tree
+ * childNode->addChild(valueNode);
+ * parentNode->addChild(childNode);
+ *
+ * //add another node set
+ * childNode = phb->createChild(ELEMENT_NODE);
+ * childNode->setLocalName("password");
+ *
+ * valueNode = phb->createChild(CHARACTER_NODE);
+ * valueNode->setValue("Test Password");
+ *
+ * childNode->addChild(valueNode);
+ * parentNode->addChild(childNode);
+ *
+ * phb->addChild(parentNode);
+ * </PRE>
+ *
+ * @param pachLocalName Local tag name of the SOAP header. e.g. TestHeader
+ * @param pachUri Namespace URI to be used in SOAP header.
+ e.g http://ws.apache.org/axisCppTestHeader/
+ *
+ * @return Pointer to the creater SOAP header block.
+ */
+ IHeaderBlock * AXISCALL createSOAPHeaderBlock(AxisChar * pachLocalName,
+ AxisChar * pachUri);
+
+ /**
+ * Create and add a SOAP header block to the Stub.
+ *
+ * This will create a header block that would look like the following when
+ * serialized:
+ * <PRE>
+ * <th:TestHeader xmlns:th="http://ws.apache.org/axisCppTest/">
+ * </th:TestHeader>
+ * </PRE>
+ *
+ * User must use the IHeaderBlock pointer returned and fill in the header structure.
+ * e.g. To make the SOAP header look like
+ * <PRE>
+ * <SOAP-ENV:Header>
+ * <th:TestHeader xmlns:th="http://ws.apache.org/axisCppTest/">
+ * <Credentials>
+ * <username>Test User</username>
+ * <password>Test Password</password>
+ * </Credentials>
+ * </th:TestHeader>
+ * </SOAP-ENV:Header>
+ * </PRE>
+ * the following code segment coule be used
+ * <PRE>
+ * IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
+ * "http://ws.apache.org/axisCppTest/",
+ * "th");
* //create parent node
* BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
* parentNode->setLocalName("Credentials");
@@ -430,8 +501,8 @@
*
* @return Pointer to the creater SOAP header block.
*/
- IHeaderBlock * AXISCALL createSOAPHeaderBlock(AxisChar * pachLocalName,
- AxisChar * pachUri);
+ IHeaderBlock* AXISCALL createSOAPHeaderBlock(AxisChar * pachLocalName,
+ AxisChar * pachUri, AxisChar * pachPrefix);
/**
* Iterator initiatior for SOAP header blocks
1.82 +12 -0 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- Call.cpp 22 Dec 2004 08:28:34 -0000 1.81
+++ Call.cpp 6 Jan 2005 05:21:52 -0000 1.82
@@ -25,6 +25,12 @@
* Added setProxy
*/
+/*
+ * Revision 1.2 2005/01/06 Roshan
+ * Added IHeaderBlock* Call::createHeaderBlock(AxisChar* pachLocalName,
+ * AxisChar* pachUri, AxisChar* pachPrefix)
+ */
+
#include <axis/client/Call.hpp>
#include <axis/AxisException.hpp>
@@ -672,6 +678,12 @@
AxisChar* pachUri)
{
return new HeaderBlock(pachLocalName, pachUri);
+}
+
+IHeaderBlock* Call::createHeaderBlock(AxisChar* pachLocalName,
+ AxisChar* pachUri, AxisChar* pachPrefix)
+{
+ return new HeaderBlock(pachLocalName, pachUri, pachPrefix);
}
int Call::getStatus()
1.31 +12 -0 ws-axis/c/src/engine/client/Stub.cpp
Index: Stub.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Stub.cpp 20 Dec 2004 08:36:14 -0000 1.30
+++ Stub.cpp 6 Jan 2005 05:21:52 -0000 1.31
@@ -358,3 +358,15 @@
else
return APT_UNKNOWN;
}
+
+IHeaderBlock* Stub::createSOAPHeaderBlock(AxisChar *pachLocalName, AxisChar *pachUri, AxisChar *pachPrefix)
+{
+ if (pachLocalName && pachUri && pachPrefix)
+ {
+ IHeaderBlock *pNewSoapheader = m_pCall->createHeaderBlock(pachLocalName, pachUri, pachPrefix);
+ m_vSOAPHeaderBlocks.push_back(pNewSoapheader);
+ return pNewSoapheader;
+ }
+ else
+ return NULL;
+}