You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by King Minxiao <fr...@gmail.com> on 2005/12/12 04:09:24 UTC

attachment problems in using axis

I wrote a webservice to send files to client with axis attachment. Here is
my method doWithAttachment().
public void doWithAttachment() {
   Message repMsg =3D AxisEngine.getCurrentMessageContext
().getResponseMessage();
    AttachmentPart ap =3D repMsg.createAttachmentPart();
    ap.setDataHandler(new DataHandler(new
FileDataSource("C:\\temp\\output\\test.txt")));
    repMsg.addAttachmentPart(ap);
    repMsg.dispose();
}
The content of file C:\\temp\\output\\test.txt is "This is a file used to
testing attachments in axis".
I received badly soap message when this method is invoked.Here is an
example for my received soap message.

------=_Part_11_10258369.1134353376973
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
@@@lable
Content-Id: <B2D785656F586DD1E238D3CD93B71D2F>

<?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"><soapenv:Body/></soapenv:Envelope
>
------=_Part_11_10258369.1134353376973
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id: <84AD45638D8A4A56555EAC788D829480>

I have to resolve to problems.
(1).Something is missed at the end of this soap message.They are
attachment-content and the attachment-caption.
(2).At the lable of soap message(just @@@lable at above),I want to add
something just like "Content-Length: 100",What should I do in my method?
Any suggestion is expected.

Mxking.
fromMxking@gmail.com