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/11/30 04:08:13 UTC
cvs commit: ws-axis/c/include/axis IHandlerSoapDeSerializer.hpp
roshan 2004/11/29 19:08:13
Modified: c/src/soap SoapDeSerializer.h SoapDeSerializer.cpp
c/include/axis IHandlerSoapDeSerializer.hpp
Log:
added code to support, setting and accessing the soap body, which is a requirement by Handlers
Revision Changes Path
1.23 +28 -0 ws-axis/c/src/soap/SoapDeSerializer.h
Index: SoapDeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SoapDeSerializer.h 23 Nov 2004 17:21:04 -0000 1.22
+++ SoapDeSerializer.h 30 Nov 2004 03:08:13 -0000 1.23
@@ -34,7 +34,15 @@
* @class SoapDeSerializer
* @brief interface for the SoapDeSerializer class.
* @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)
+ * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
+
+/*
+ * Revision 1.1 2004/11/27 roshan
+ * Added the implementation of the setNewSoapBody() method. For the same
+ * purpose added the new class "DeSerializerMemBufInputStream".
+ */
+
class SoapDeSerializer : public IHandlerSoapDeSerializer
{
private:
@@ -73,6 +81,7 @@
*/
xsd__hexBinary AXISCALL getBodyAsHexBinary();
xsd__base64Binary AXISCALL getBodyAsBase64Binary();
+ AxisChar* AXISCALL getBodyAsChar();
int AXISCALL setNewSoapBody(AxisChar* pNewSoapBody);
bool isAnyMustUnderstandHeadersLeft();
int getFault();
@@ -213,6 +222,25 @@
AnyType* AXISCALL getAnyObject();
void serializeTag(AxisString& xmlStr, const AnyElement* node, AxisString& nsDecls);
void getChardataAs(void* pValue, XSDTYPE type);
+
+ /*
+ *This class is used by the DeSerializer to set the input stream back to
+ * the parser in following situations:
+ * - The SOAPHeaders change the SOAPBody and want to set it back to the
+ * DeSerializer.
+ */
+ class DeSerializerMemBufInputStream : public AxisIOStream
+ {
+ private:
+ const char* m_pcDeSeriaMemBuffer;
+ public:
+ DeSerializerMemBufInputStream(const char* pcDeSeriaMemBuffer)
+ {m_pcDeSeriaMemBuffer = pcDeSeriaMemBuffer;};
+ virtual ~DeSerializerMemBufInputStream(){};
+ AXIS_TRANSPORT_STATUS sendBytes(const char* pcSendBuffer, const void* pBufferid);
+ AXIS_TRANSPORT_STATUS getBytes(char* pcBuffer, int* piRetSize);
+ };
+
private:
1.115 +30 -2 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.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- SoapDeSerializer.cpp 29 Nov 2004 12:46:36 -0000 1.114
+++ SoapDeSerializer.cpp 30 Nov 2004 03:08:13 -0000 1.115
@@ -36,6 +36,10 @@
* SoapDeSerializer::getHeader() method was completely rewriten.
*/
+/*
+ * Revision 1.3 2004/11/27 roshan
+ * Added the implementation of the setNewSoapBody() method.
+ */
#ifdef WIN32
#pragma warning (disable : 4101)
@@ -3911,11 +3915,16 @@
return bb;
}
+AxisChar* SoapDeSerializer::getBodyAsChar()
+{
+ return NULL;
+}
+
int
SoapDeSerializer::setNewSoapBody (AxisChar * pNewSoapBody)
{
- /* TODO */
- return 0;
+ DeSerializerMemBufInputStream stream(pNewSoapBody);
+ return m_pParser->setInputStream(&stream);
}
bool
@@ -4255,5 +4264,24 @@
return llRetVal;
}
+
+/* This function is never called. */
+AXIS_TRANSPORT_STATUS SoapDeSerializer::DeSerializerMemBufInputStream::sendBytes(const char* pcSendBuffer, const void* pBufferid)
+{
+ return TRANSPORT_FINISHED;
+}
+
+AXIS_TRANSPORT_STATUS SoapDeSerializer::DeSerializerMemBufInputStream::getBytes(char* pcBuffer, int* piRetSize)
+{
+ if (!m_pcDeSeriaMemBuffer) return TRANSPORT_FAILED;
+ int nBufLen = strlen(m_pcDeSeriaMemBuffer);
+ if (0 == nBufLen) return TRANSPORT_FINISHED;
+ nBufLen = ((*piRetSize - 1) < nBufLen) ? (*piRetSize - 1) : nBufLen;
+ strncpy(pcBuffer, m_pcDeSeriaMemBuffer, nBufLen);
+ pcBuffer[nBufLen] = 0;
+ m_pcDeSeriaMemBuffer+=nBufLen;
+ return TRANSPORT_IN_PROGRESS;
+}
+
AXIS_CPP_NAMESPACE_END
1.2 +1 -0 ws-axis/c/include/axis/IHandlerSoapDeSerializer.hpp
Index: IHandlerSoapDeSerializer.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/IHandlerSoapDeSerializer.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IHandlerSoapDeSerializer.hpp 23 Nov 2004 11:11:11 -0000 1.1
+++ IHandlerSoapDeSerializer.hpp 30 Nov 2004 03:08:13 -0000 1.2
@@ -62,6 +62,7 @@
*/
virtual xsd__hexBinary AXISCALL getBodyAsHexBinary()=0;
virtual xsd__base64Binary AXISCALL getBodyAsBase64Binary()=0;
+ virtual AxisChar* AXISCALL getBodyAsChar()=0;
virtual int AXISCALL setNewSoapBody(AxisChar* pNewSoapBody)=0;
/**