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 2004/12/01 09:45:26 UTC
cvs commit: ws-axis/c/src/soap SoapDeSerializer.cpp
roshan 2004/12/01 00:45:25
Modified: c/src/xml AnyElement.h
c/src/soap SoapDeSerializer.cpp
Log:
fixed a problem of getting the body
Revision Changes Path
1.2 +36 -0 ws-axis/c/src/xml/AnyElement.h
Index: AnyElement.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/xml/AnyElement.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AnyElement.h 6 Jul 2004 14:16:48 -0000 1.1
+++ AnyElement.h 1 Dec 2004 08:45:23 -0000 1.2
@@ -21,11 +21,23 @@
* funtion.
*
* @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)
+ * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
+
+/*
+ * Revision 1.1 2004/12/01 roshan
+ * Added the new class "AnyElemntUtils". Here we have a method to convers a
+ * AnyElement to a string.
+ */
+
#if !defined(__ANYELEMENT_H__OF_AXIS_INCLUDED_)
#define __ANYELEMENT_H__OF_AXIS_INCLUDED_
+#include <string>
+
+using namespace std;
+
/**
* @def MAX_NO_OF_ATTRIBUTES
* Defines the maximum number of attributes that AnyElement can contain.
@@ -82,6 +94,30 @@
*/
const char* m_pchAttributes[MAX_NO_OF_ATTRIBUTES*3];
} AnyElement;
+
+/*
+ * The AnyElement utility class.
+ */
+class AnyElemntUtils
+{
+ public:
+ static string toString(const AnyElement* pNode) {
+ string sTmpVal;
+ switch(pNode->m_type) {
+ case CHARACTER_ELEMENT:
+ sTmpVal = string(pNode->m_pchNameOrValue);
+ break;
+ case END_ELEMENT:
+ //sTmpVal = "<" + pNode->m_pchNameOrValue + ;
+ break;
+ case START_ELEMENT:
+ //TODO.
+ break;
+ }
+
+ return sTmpVal;
+ }
+};
#endif
1.117 +44 -3 ws-axis/c/src/soap/SoapDeSerializer.cpp
Index: SoapDeSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- SoapDeSerializer.cpp 30 Nov 2004 17:15:44 -0000 1.116
+++ SoapDeSerializer.cpp 1 Dec 2004 08:45:23 -0000 1.117
@@ -3911,13 +3911,54 @@
SoapDeSerializer::getBodyAsBase64Binary ()
{
/* TODO */
- xsd__base64Binary bb;
- return bb;
+
+ AxisChar* pBodyContent = (AxisChar*)malloc(1000);
+ pBodyContent[0] = '\0';
+
+ m_pNode = m_pParser->next ();
+
+ if ((START_ELEMENT == m_pNode->m_type) &&
+ (0 == strcmp (m_pNode->m_pchNameOrValue,
+ SoapKeywordMapping::map (m_nSoapVersion).
+ pchWords[SKW_BODY]))) {
+ /* This is done to skip the BODY element declaration*/
+ m_pNode = m_pParser->next ();
+ }
+
+ while (!((END_ELEMENT == m_pNode->m_type) &&
+ (0 == strcmp (m_pNode->m_pchNameOrValue,
+ SoapKeywordMapping::map (m_nSoapVersion).
+ pchWords[SKW_BODY])))) {
+ strcat(pBodyContent, (AnyElemntUtils::toString(m_pNode)).c_str());
+ }
+
+ return decodeFromBase64Binary(pBodyContent);
+
}
AxisChar* SoapDeSerializer::getBodyAsChar()
{
- return NULL;
+ AxisChar* pBodyContent = (AxisChar*)malloc(1000);
+ pBodyContent[0] = '\0';
+
+ m_pNode = m_pParser->next ();
+
+ if ((START_ELEMENT == m_pNode->m_type) &&
+ (0 == strcmp (m_pNode->m_pchNameOrValue,
+ SoapKeywordMapping::map (m_nSoapVersion).
+ pchWords[SKW_BODY]))) {
+ /* This is done to skip the BODY element declaration*/
+ m_pNode = m_pParser->next ();
+ }
+
+ while (!((END_ELEMENT == m_pNode->m_type) &&
+ (0 == strcmp (m_pNode->m_pchNameOrValue,
+ SoapKeywordMapping::map (m_nSoapVersion).
+ pchWords[SKW_BODY])))) {
+ strcat(pBodyContent, (AnyElemntUtils::toString(m_pNode)).c_str());
+ }
+
+ return pBodyContent;
}
int