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 bu...@apache.org on 2004/01/21 17:27:58 UTC
DO NOT REPLY [Bug 26314] New: -
Attachments: createAttachmentPart broken (or setContent)
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26314>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26314
Attachments: createAttachmentPart broken (or setContent)
Summary: Attachments: createAttachmentPart broken (or setContent)
Product: Axis
Version: 1.1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Normal
Priority: Other
Component: Basic Architecture
AssignedTo: axis-dev@ws.apache.org
ReportedBy: apache.k.ulib@recursor.net
I "redirect" the InputStream I get from URLConnection.getInputStream() to
javax.xml.soap.SOAPMessage.createAttachmentPart() as in the example below.
final SOAPMessage soapMsg = msgContext.getResponseMessage();
final URL fileURL = new URL(fileServerURLContext, spec);
final URLConnection connection = fileURL.openConnection();
connection.connect();
final InputStream fileStream = connection.getInputStream();
final javax.xml.soap.AttachmentPart attachPart =
soapMsg.createAttachmentPart(fileStream,
"application/octet-stream");
soapMsg.addAttachmentPart(attachPart);
For some reason, createAttachmentPart or addAttachmentPart (probably the former)
mess up larger attachments by replacing parts of the content with null-bytes.
For example, the first 2920 bytes may come out correct, and then a couple
hundred or thousand bytes are replaced by null values, after which non-null
bytes appear again.
However, this only occurs when directly feeding the InputStream from
URLConnection.getInputStream() to createAttachmentPart(). If I first store the
URLConnection's InputStream in a file and then feed the file to
createAttachmentPart(), the problem disappears.
This problem also depends on the file size. For example, a 14KB file and a few
smaller files came through alright, but a 153KB and a 61KB files were broken.