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 ra...@apache.org on 2005/01/21 13:26:14 UTC
cvs commit: ws-axis/c/include/axis IWrapperSoapDeSerializer.hpp ISoapAttachment.hpp
rangika 2005/01/21 04:26:14
Modified: c/src/soap SoapDeSerializer.h SoapDeSerializer.cpp
SoapSerializer.cpp SoapSerializer.h
c/src/server/apache2 Apache2Transport.h Apache2Transport.cpp
c/src/transport SOAPTransport.h
c/src/transport/axis2 Axis2Transport.h
c/include/axis IWrapperSoapDeSerializer.hpp
ISoapAttachment.hpp
Log:
changes added to support Attachments
Revision Changes Path
1.28 +4 -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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- SoapDeSerializer.h 17 Jan 2005 11:59:51 -0000 1.27
+++ SoapDeSerializer.h 21 Jan 2005 12:26:13 -0000 1.28
@@ -236,6 +236,10 @@
void serializeTag(AxisString& xmlStr, const AnyElement* node, AxisString& nsDecls);
void getChardataAs(void* pValue, XSDTYPE type);
+ /**
+ *Returns the attachemtn object for the given id.
+ */
+ ISoapAttachment* getAttachment(const char* pcAttachmentid);
/*
*This class is used by the DeSerializer to set the input stream back to
* the parser in following situations:
1.129 +5 -0 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.128
retrieving revision 1.129
diff -u -r1.128 -r1.129
--- SoapDeSerializer.cpp 20 Jan 2005 19:34:50 -0000 1.128
+++ SoapDeSerializer.cpp 21 Jan 2005 12:26:13 -0000 1.129
@@ -3846,6 +3846,7 @@
return AXIS_FAIL;
while (TRANSPORT_IN_PROGRESS ==
m_pInputStream->getBytes (pBuffer, &nChars));
+
return AXIS_SUCCESS;
}
@@ -4243,5 +4244,9 @@
return TRANSPORT_IN_PROGRESS;
}
+ISoapAttachment* SoapDeSerializer::getAttachment(const char* pcAttachmentid)
+{
+ return m_pInputStream->getAttachment(pcAttachmentid);
+}
AXIS_CPP_NAMESPACE_END
1.87 +22 -2 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.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- SoapSerializer.cpp 14 Jan 2005 13:42:19 -0000 1.86
+++ SoapSerializer.cpp 21 Jan 2005 12:26:14 -0000 1.87
@@ -244,11 +244,19 @@
{
if(m_pSoapEnvelope)
{
+ if (checkAttachmentAvailability()) {
+ serialize("\n------=MIME BOUNDARY\n", NULL);
+ serialize(pStream->getIncomingSOAPMimeHeaders(), "\n\n", NULL);
+ }
+
serialize("<?xml version='1.0' encoding='utf-8' ?>", NULL);
iStatus= m_pSoapEnvelope->serialize(*this,
(SOAP_VERSION)m_iSoapVersion);
- serializeAttachments(*this);
+ if (checkAttachmentAvailability()) {
+ serialize("\n------=MIME BOUNDARY\n", NULL);
+ serializeAttachments(*this);
+ }
}
}
@@ -938,6 +946,8 @@
{
((SoapAttachment*)((*itCurrAttach).second))->serialize(pSZ);
+ pSZ.serialize("\n------=MIME BOUNDARY\n", NULL);
+
itCurrAttach++;
}
}
@@ -989,9 +999,19 @@
return pSAttch;
}
+bool SoapSerializer::checkAttachmentAvailability()
+{
+ map<AxisXMLString, ISoapAttachment*>::iterator itCurrAttach= m_SoapAttachments.begin();
+
+ if(itCurrAttach != m_SoapAttachments.end())
+ return true;
+ else
+ return false;
+
+}
+
IHeaderBlock* SoapSerializer::getCurrentHeaderBlock()
{
return m_pSoapEnvelope->m_pSoapHeader->getCurrentHeaderBlock();
}
-
AXIS_CPP_NAMESPACE_END
1.37 +2 -0 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.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- SoapSerializer.h 13 Jan 2005 14:05:42 -0000 1.36
+++ SoapSerializer.h 21 Jan 2005 12:26:14 -0000 1.37
@@ -152,9 +152,11 @@
IHeaderBlock* createHeaderBlock();
private:
+ bool checkAttachmentAvailability();
void serializeAttachments(SoapSerializer &pSZ);
BasicTypeSerializer m_BTSZ;
SOAPTransport* m_pOutputStream;
+
public:
IHeaderBlock* getCurrentHeaderBlock();
ISoapAttachment* createSoapAttachement();
1.10 +7 -1 ws-axis/c/src/server/apache2/Apache2Transport.h
Index: Apache2Transport.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/apache2/Apache2Transport.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Apache2Transport.h 8 Nov 2004 13:34:39 -0000 1.9
+++ Apache2Transport.h 21 Jan 2005 12:26:14 -0000 1.10
@@ -47,11 +47,15 @@
#include <string.h>
#endif
+#include "AttachmentHelper.h"
+#include <axis/ISoapAttachment.hpp>
+
AXIS_CPP_NAMESPACE_USE
class Apache2Transport : public SOAPTransport
{
public:
+ char* getIncomingSOAPMimeHeaders();
Apache2Transport(void* pContext);
virtual ~Apache2Transport();
int openConnection(){return AXIS_SUCCESS;};
@@ -66,7 +70,7 @@
void setTransportProperty(const char* pcKey, const char* pcValue);
const char* getTransportProperty(const char* pcKey);
void setAttachment(const char* pcAttachmentid, const char* pcAttachment){};
- const char* getAttachment(const char* pcAttachmentid){return "value";};
+ ISoapAttachment* getAttachment(const char* pcAttachmentid);
void setEndpointUri(const char* pcEndpointUri)
{m_pcEndpointUri = new char[strlen(pcEndpointUri)+1]; strcpy(m_pcEndpointUri,pcEndpointUri);};
void setSessionId(const char* pcSessionId);
@@ -85,10 +89,12 @@
void setTimeout(const long lSeconds) {};
private:
+ AttachmentHelper* pAttachmentHelper;
void* m_pContext;
#ifndef CHUNCKED_DATA_SUPPORTED
BufferInfo* m_pBuffers;
#endif
+
};
#endif
1.4 +29 -1 ws-axis/c/src/server/apache2/Apache2Transport.cpp
Index: Apache2Transport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/apache2/Apache2Transport.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Apache2Transport.cpp 8 Nov 2004 08:47:19 -0000 1.3
+++ Apache2Transport.cpp 21 Jan 2005 12:26:14 -0000 1.4
@@ -35,6 +35,8 @@
m_pBuffers = new BufferInfo[NO_OF_SERIALIZE_BUFFERS];
memset((void*)m_pBuffers, 0, sizeof(BufferInfo)*NO_OF_SERIALIZE_BUFFERS);
#endif
+
+
}
Apache2Transport::~Apache2Transport()
@@ -145,13 +147,28 @@
AXIS_TRANSPORT_STATUS Apache2Transport::getBytes(char* pBuffer, int* piSize)
{
- int nBufSize = *piSize;
+
+ int nBufSize = *piSize;
int len_read;
len_read = ap_get_client_block((request_rec*) m_pContext, pBuffer, *piSize);
+
+ if (strstr(pBuffer, "Content-Id")) {
+ pAttachmentHelper = new AttachmentHelper();
+ char *pAttachBuffer = (char*)malloc(1000);
+ char *mimeBoundary = (char*)malloc(1000);
+
+ pAttachmentHelper->extract_Attachment(pBuffer);
+ pAttachmentHelper->extract_SOAPMimeHeaders(pBuffer);
+ pAttachmentHelper->extract_Soap(pBuffer);
+
+ }
+
*piSize = len_read;
+
if (len_read < nBufSize)
{
pBuffer[len_read] = '\0';
+
return TRANSPORT_FINISHED;
}
else
@@ -276,3 +293,14 @@
return AXIS_HTTP_UNSUPPORTED;
}
}
+
+ISoapAttachment* Apache2Transport::getAttachment(const char* pcAttachmentid)
+{
+ ISoapAttachment* pAttch = pAttachmentHelper->getAttachment(pcAttachmentid);
+ return pAttch;
+};
+
+char* Apache2Transport::getIncomingSOAPMimeHeaders()
+{
+ return pAttachmentHelper->getIncomingSOAPMimeHeaders();
+}
\ No newline at end of file
1.12 +6 -2 ws-axis/c/src/transport/SOAPTransport.h
Index: SOAPTransport.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/SOAPTransport.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SOAPTransport.h 20 Dec 2004 08:23:30 -0000 1.11
+++ SOAPTransport.h 21 Jan 2005 12:26:14 -0000 1.12
@@ -32,6 +32,7 @@
#define AXIS_SOAPTRANSPORT_H__OF_AXIS_INCLUDED_
#include <axis/GDefine.hpp>
+#include <axis/ISoapAttachment.hpp>
/**
* @file SOAPTransport.h
@@ -286,8 +287,11 @@
* to locate the corresponding attachment.
* @return The attachment if available. Returns null if the attachment
* corresponding to the pcAttachmentid is not found.
- */
- virtual const char* getAttachment(const char* pcAttachmentid)=0;
+ */
+ virtual ISoapAttachment* getAttachment(const char* pcAttachmentid)=0;
+
+ virtual char* getIncomingSOAPMimeHeaders()=0;
+
/**
* Sets the the remote endpoint for tranport to connect to. This URI
* depends on the the transport type.
1.20 +3 -1 ws-axis/c/src/transport/axis2/Axis2Transport.h
Index: Axis2Transport.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Axis2Transport.h 20 Dec 2004 08:23:30 -0000 1.19
+++ Axis2Transport.h 21 Jan 2005 12:26:14 -0000 1.20
@@ -63,7 +63,7 @@
throw (AxisTransportException);
void setAttachment (const char *pcAttachmentId, const char *pcAttachment) {};
- const char *getAttachment (const char *pcAttachmentId) { return NULL;};
+ ISoapAttachment* getAttachment (const char *pcAttachmentId) { return NULL;};
void setSessionId (const char *pcSessionId);
@@ -206,6 +206,8 @@
* @param bSession - true is session should be maintained. False otherwise.
*/
virtual void setMaintainSession(bool bSession);
+
+ char* getIncomingSOAPMimeHeaders() {return NULL;}
protected:
1.3 +3 -1 ws-axis/c/include/axis/IWrapperSoapDeSerializer.hpp
Index: IWrapperSoapDeSerializer.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/IWrapperSoapDeSerializer.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IWrapperSoapDeSerializer.hpp 7 Jan 2005 16:35:20 -0000 1.2
+++ IWrapperSoapDeSerializer.hpp 21 Jan 2005 12:26:14 -0000 1.3
@@ -20,7 +20,7 @@
#include "AxisUserAPI.hpp"
#include "TypeMapping.hpp"
#include "WSDDDefines.hpp"
-
+#include "ISoapAttachment.hpp"
/**
@class IWrapperSoapDeSerializer
@brief interface for the IWrapperSoapDeSerializer class.
@@ -101,6 +101,7 @@
virtual long AXISCALL getElementAsDuration(const AxisChar* pName,
const AxisChar* pNamespace)=0;
+
virtual int AXISCALL getAttributeAsInt(const AxisChar* pName,
const AxisChar* pNamespace)=0;
virtual xsd__boolean AXISCALL getAttributeAsBoolean(const AxisChar* pName,
@@ -158,6 +159,7 @@
virtual int getHeader()=0;
virtual AnyType* AXISCALL getAnyObject()=0;
virtual void getChardataAs(void* pValue, XSDTYPE type)=0;
+ virtual ISoapAttachment* getAttachment(const char* pcAttachmentid)=0;
};
AXIS_CPP_NAMESPACE_END
1.2 +1 -1 ws-axis/c/include/axis/ISoapAttachment.hpp
Index: ISoapAttachment.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/ISoapAttachment.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ISoapAttachment.hpp 7 Jan 2005 08:55:19 -0000 1.1
+++ ISoapAttachment.hpp 21 Jan 2005 12:26:14 -0000 1.2
@@ -36,7 +36,7 @@
AXIS_CPP_NAMESPACE_START
-class ISoapAttachment
+class STORAGE_CLASS_INFO ISoapAttachment
{
public: