axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ally Hume" <>
Subject Empty SOAP body when I add an attachment problem
Date Mon, 19 Dec 2005 17:06:17 GMT

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");

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

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

Any help would be greatly appreciated.


Ally Hume


Example of response with empty SOAP body in case this includes any

HTTP/1.1 200 OK

Content-Type: multipart/related; type="text/xml";

Date: Mon, 19 Dec 2005 14:53:39 GMT

Server: Apache-Coyote/1.1

Connection: close


Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: binary

Content-Id: <9A7A8A7390896B7981077BC7281B390B>

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope


Content-Type: text/plain

Content-Transfer-Encoding: binary

Content-Id: <D2852F9908AACC88F656F033A7626DE4>



Ally Hume
Principal Consultant
EPCC, University of Edinburgh
James Clerk Maxwell Building
Mayfield Road                 E-mail:
Edinburgh, EH9 3JZ            Phone:  + 44 (0) 131 651 3397
United Kingdom                Fax:    + 44 (0) 131 650 6555

View raw message