axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whitl...@apache.org
Subject cvs commit: ws-axis/c/tests/utils/monitor/org/apache/test MockServerThread.java
Date Wed, 15 Jun 2005 13:16:44 GMT
whitlock    2005/06/15 06:16:44

  Modified:    c/include/axis ISoapAttachment.hpp
               c/src/soap SoapSerializer.cpp
               c/src/transport/axis3 HTTPTransport.cpp
               c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest
                        DynUnrefAttachmentTest.cpp
               c/tests/utils/monitor/org/apache/test MockServerThread.java
  Log:
  More fixes for unreferenced attachments.
  Correct the mime headers and the format of the mime message
  Change the mime boundary string
  Update the unit test case to include better mime headers
  
  Revision  Changes    Path
  1.5       +4 -0      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ISoapAttachment.hpp	5 May 2005 08:56:13 -0000	1.4
  +++ ISoapAttachment.hpp	15 Jun 2005 13:16:44 -0000	1.5
  @@ -42,6 +42,10 @@
       AXIS_BINARY = 1
   } AXIS_ATTACHMENT_ENCODING_TYPE;
   
  +#define AXIS_CONTENT_ID					"Content-Id"
  +#define AXIS_CONTENT_TYPE				"Content-Type"
  +#define AXIS_CONTENT_TRANSFER_ENCODING	"Content-Transfer-Encoding"
  +#define AXIS_CONTENT_LOCATION			"Content-Location"
   
   class STORAGE_CLASS_INFO ISoapAttachment  
   {
  
  
  
  1.122     +15 -11    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.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- SoapSerializer.cpp	14 Jun 2005 16:27:59 -0000	1.121
  +++ SoapSerializer.cpp	15 Jun 2005 13:16:44 -0000	1.122
  @@ -46,6 +46,7 @@
   #include "../common/AxisConfig.h"
   
   extern AXIS_CPP_NAMESPACE_PREFIX AxisConfig* g_pConfig;
  +#define MIMEBOUNDARY	"------=MIME_BOUNDARY"
   
   AXIS_CPP_NAMESPACE_START
   
  @@ -305,9 +306,9 @@
   				if (NULL != pszSOAPMimeHeaders) 
   				{	// Server code
   					string asSOAPMimeHeaders = pszSOAPMimeHeaders;
  -					int		start			= asSOAPMimeHeaders.find( "Content-Type");
  -					int		startPosIdValue = asSOAPMimeHeaders.find( "<", start + strlen( "Content-Id:"))
+ 1;
  -					int		endPosIdValue   = asSOAPMimeHeaders.find( ">", start + strlen( "Content-Type"));
  +					int		start			= asSOAPMimeHeaders.find( AXIS_CONTENT_TYPE);
  +					int		startPosIdValue = asSOAPMimeHeaders.find( "<", start + strlen( AXIS_CONTENT_ID
":")) + 1;
  +					int		endPosIdValue   = asSOAPMimeHeaders.find( ">", start + strlen( AXIS_CONTENT_TYPE));
   					int		length          = endPosIdValue - startPosIdValue ;	
   
   					string asStartID = asSOAPMimeHeaders.substr (startPosIdValue,length); 
  @@ -315,19 +316,22 @@
   					string *	asContentType = new string( "multipart/related; type=\"text/xml\"; start=\"<");
   
   					*asContentType = *asContentType + asStartID + ">\"";
  -					*asContentType = *asContentType + ";  boundary=\"------=MIME BOUNDARY\"";
  +					*asContentType = *asContentType + ";  boundary=\"" MIMEBOUNDARY "\"";
   
   					pStream->setTransportProperty( CONTENT_TYPE, (*asContentType).c_str()); 
   
  -					serialize( "\n------=MIME BOUNDARY\n", NULL);
  +					serialize( "\n" MIMEBOUNDARY "\n", NULL);
   					serialize( pStream->getIncomingSOAPMimeHeaders(), "\n\n", NULL);
   				}
   				else
   				{	// Client code
  -					#define MIME_BOUNDARY "----=MIME_BOUNDARY"
  -					pStream->setTransportProperty( CONTENT_TYPE, 
  -						"multipart/related; type=\"text/xml\"; boundary=\"" MIME_BOUNDARY "\"");
  -					serialize("\n" MIME_BOUNDARY "\n", NULL);
  +					pStream->setTransportProperty( AXIS_CONTENT_TYPE, 
  +						"multipart/related; type=\"text/xml\"; boundary=\"" MIMEBOUNDARY "\"");
  +					serialize("\n" MIMEBOUNDARY "\n", NULL);
  +                    serialize(AXIS_CONTENT_TYPE ": text/xml; charset=UTF-8\n", NULL);
  +                    serialize(AXIS_CONTENT_TRANSFER_ENCODING ": binary\n", NULL);
  +                    serialize(AXIS_CONTENT_ID ": <4E2B3048B540B4C3271D6A6726571E0F>\n",
NULL);  // TODO: needs changing
  +                    serialize("\n", NULL);  // Extra \n terminates headers
   				}
   			}
   
  @@ -344,7 +348,7 @@
   
   			if( checkAttachmentAvailability())
   			{
  -				serialize( "\n------=MIME BOUNDARY\n", NULL);
  +				serialize( "\n" MIMEBOUNDARY, NULL);
   				serializeAttachments( *this);
   			}
   		}
  @@ -1132,7 +1136,7 @@
       {        
           ((SoapAttachment *) ((*itCurrAttach).second))->serialize(pSZ);
   
  -		pSZ.serialize("\n------=MIME BOUNDARY\n", NULL);
  +		pSZ.serialize("\n" MIMEBOUNDARY "\n", NULL);
   
           itCurrAttach++;
       }
  
  
  
  1.33      +11 -1     ws-axis/c/src/transport/axis3/HTTPTransport.cpp
  
  Index: HTTPTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis3/HTTPTransport.cpp,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- HTTPTransport.cpp	14 Jun 2005 10:35:40 -0000	1.32
  +++ HTTPTransport.cpp	15 Jun 2005 13:16:44 -0000	1.33
  @@ -368,7 +368,17 @@
       m_strHeaderBytesToSend += ":";
       m_strHeaderBytesToSend += buff;
       m_strHeaderBytesToSend += "\r\n";
  -    m_strHeaderBytesToSend += "Content-Type: text/xml; charset=UTF-8\r\n";
  +
  +	bool foundCT = false;
  +    for (unsigned int j = 0; j < m_vHTTPHeaders.size (); j++)
  +    {
  +		if (0==strcmp(AXIS_CONTENT_TYPE,m_vHTTPHeaders[j].first.c_str())) foundCT = true;
  +    }
  +
  +	// The Content-Type must be set, but it may already be set in m_strHeaderBytesToSend
  +	// if we're using attachments, for example.
  +	if (!foundCT)
  +		m_strHeaderBytesToSend += AXIS_CONTENT_TYPE ": text/xml; charset=UTF-8\r\n";
   
       // Set other HTTP headers
       for (unsigned int i = 0; i < m_vHTTPHeaders.size (); i++)
  
  
  
  1.3       +3 -2      ws-axis/c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest/DynUnrefAttachmentTest.cpp
  
  Index: DynUnrefAttachmentTest.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest/DynUnrefAttachmentTest.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DynUnrefAttachmentTest.cpp	14 Jun 2005 16:27:59 -0000	1.2
  +++ DynUnrefAttachmentTest.cpp	15 Jun 2005 13:16:44 -0000	1.3
  @@ -30,8 +30,9 @@
   		call.setEndpointURI(argv[1]);
   
   		ISoapAttachment *att = call.createSoapAttachment();
  -		att->addHeader("Content-Id","HERES_MY_CONTENT_ID");
  -		att->addHeader("Content-Type","text/plain");
  +		att->addHeader(AXIS_CONTENT_ID,"HERES_MY_CONTENT_ID");
  +		att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
  +		att->addHeader(AXIS_CONTENT_TRANSFER_ENCODING,"base64");
   		
   		xsd__base64Binary b64b;
   		char *text = "This is the attachment body for the DynUnrefAttachmentTest";
  
  
  
  1.4       +1 -1      ws-axis/c/tests/utils/monitor/org/apache/test/MockServerThread.java
  
  Index: MockServerThread.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/utils/monitor/org/apache/test/MockServerThread.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MockServerThread.java	14 Jun 2005 16:27:59 -0000	1.3
  +++ MockServerThread.java	15 Jun 2005 13:16:44 -0000	1.4
  @@ -33,7 +33,7 @@
   {
       // NOTE: We read in this string plus two bytes (the end of the request)
       private static String   ENVELOPE_TAG    ="</SOAP-ENV:Envelope>";
  -    private static String   MIME_BOUNDARY    ="MIME BOUNDARY";
  +    private static String   MIME_BOUNDARY    ="MIME_BOUNDARY";
   
       private static int      CHARBUFFER_SIZE =20000;
   
  
  
  

Mime
View raw message