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 Ally Hume <a....@epcc.ed.ac.uk> on 2005/12/19 18:06:17 UTC
Empty SOAP body when I add an attachment problem
Hi,
Axis 1.2
I have a web service operation that returns an object which is
successfully serialized and returned in the body of the SOAP message.
I now want to allow this operation to also include an attachment in
the response. So I have added code like the following:
MessageContext context = MessageContext.getCurrentContext();
Message responseMessage = context.getResponseMessage();
AttachmentPart ap = responseMessage.createAttachmentPart();
ap.setContent("MyData", "text/plain");
responseMessage.addAttachmentPart(ap);
This successfully adds an attachment to the response but whenever I do
this the object that is returned by my method no longer appears
serialized in the SOAP body - instead the body is empty (see example
below).
Is there a vital stage I am missing? I start from the WSDL and use
wsdl2java to generate the interfaces we program against. I have not
changed the WSDL at all. I have only added the above code and added
the activation.jar and mailapi.jar jar files to the axis lib
directory.
Any help would be greatly appreciated.
Regards,
Ally Hume
----
Example of response with empty SOAP body in case this includes any
clues:
HTTP/1.1 200 OK
Content-Type: multipart/related; type="text/xml";
start="<9A7A8A7390896B7981077BC7281B390B>";
boundary="----=_Part_0_4301103.1135004018807"
Date: Mon, 19 Dec 2005 14:53:39 GMT
Server: Apache-Coyote/1.1
Connection: close
------=_Part_0_4301103.1135004018807
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <9A7A8A7390896B7981077BC7281B390B>
<?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_0_4301103.1135004018807
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id: <D2852F9908AACC88F656F033A7626DE4>
AllyTest
------=_Part_0_4301103.1135004018807--
-------------------------------------------------------------
Ally Hume
Principal Consultant
EPCC, University of Edinburgh
James Clerk Maxwell Building
Mayfield Road E-mail: a.hume@epcc.ed.ac.uk
Edinburgh, EH9 3JZ Phone: + 44 (0) 131 651 3397
United Kingdom Fax: + 44 (0) 131 650 6555
-------------------------------------------------------------