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 Matthew Davis <ga...@gmail.com> on 2006/07/29 01:38:24 UTC

Problem with multipart boundary name in 1.4

Hi everyone,

A few days ago, I posted on a message on the user list regarding a
problem I was having with multipart boundaries being incorrect in Axis
1.4 (see copy of message below).  To fix this problem, we commented
out a few lines of code in the class AttachmentsImpl.

The problem seems to be happening where the multipart object is reset.
 When Attachments.multipart is set to null and then recreated, it
appears to disconnect from the HTTP header set in the SOAP message.
The message then uses one boundary name in the HTTP header and another
in the message body.  After commenting out lines 229 and 587 of
AttachmentsImpl.java, the problem disappeared.  The environment is
Tomcat 5 and Axis 1.4.  Is this a problem anyone has experienced
before?

Thanks,
Matt

------------------------------
Originally sent to axis-user:

Hi.

We're having a peculiar problem with the MIME boundary and start field
in the HTTP/SOAP request.  The boundary delimiter sent in the header
is different than the boundary being used to delimit the individual
MIME messages.   We're using Axis 1.4 and the latest version of Sun's
Activation Framework and Mail Framework.  From a source code point of
view, we're not doing anything beyond what is in a tutorial.  I've
attached a relevant fragment of our source code and the actual HTTP
request captured.  Has anyone encountered a situation like this?

Any help would be greatly appreciated!

Thanks,
Matt


<<<< Source Fragment >>>>
SOAPPart sp;
SOAPEnvelope se;

// Create message factory
MessageFactory mf = MessageFactoryImpl.newInstance();

// Construct base message
SOAPMessage msg = mf.createMessage();
se.getBody().addAttribute(se.createName("SOAP-SEC:id"), "Body");
se.getBody().addDocument(
               XMLUtils.newDocument(new ByteArrayInputStream(request
                               .getBytes())));

// Add attachements, if any exist
if (attachments != null) {
       for (int i = 0; i < attachments.length; i++) {
               AttachmentPart ap =
msg.createAttachmentPart(attachments[i].getData(),
attachments[i].getMimeType());

               ap.setContentId(attachments[i].getContentId());
               msg.addAttachmentPart(ap);
       }
}
msg.saveChanges();

// Connect and send
SOAPConnection conn = SOAPConnectionFactory.newInstance()
               .createConnection();

SOAPMessage response = null;;
try {
       response = conn.call(msg, url);

} catch (SOAPException e) {
       logger.fatal(e);
       throw e;
}
<<< >>>





<<< MIME Message Captured by TCP sniffer >>>

POST /request HTTP/1.0
Content-Type: multipart/related; type="text/xml";
start="<23DCC2238041C471E10010668012F1E7>";
boundary="----=_Part_7_12122257.1153328467218"
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 17823


------=_Part_8_11305824.1153332521953
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <DD9113C160D03E7E697DCB6D985DA360>

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soap message truncated>
 <soapenv:Body/>
</soapenv:Envelope>
------=_Part_8_11305824.1153332521953
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Id: <urn:uuid:4d55fd3c-4d4e-7d46-1f31-0016ce22b761>

<message truncated>

------=_Part_8_11305824.1153332521953--

<<< >>>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org