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 Greg Cawthorn <gr...@voxsurf.com> on 2005/01/12 16:03:13 UTC

Extracting attachments from messaging service calls

Hello,

I am submitting a SOAP message with an attachment to a web service using
Axis 1.1. To implement a messaging service I have to use one of the
following method signatures:

public Element [] method(Element [] bodies); 
public SOAPBodyElement [] method (SOAPBodyElement [] bodies); 
public Document method(Document body); 
public void method(SOAPEnvelope req, SOAPEnvelope resp); 

I've chosen to use the last one, but I cannot find a way to retrieve the
attachment since I only have a reference to the SOAP envelope rather than
the message itself. Could someone please tell me how I can access the entire
SOAP message so that I can extract my attachment.

Thanks,

Greg

RE: Extracting attachments from messaging service calls

Posted by Jason Judt <jj...@atcorp.com>.
Hi,

You'll find a sample problem in [AXIS_HOME]/samples/attachements and
especially EchoAttachementsService.java

Of particular interest to you would be the line that says:

org.apache.axis.MessageContext msgContext =
org.apache.axis.MessageContext.getCurrentContext();

>From the message context one can get a reference to the Message which can be
used to get AttachementParts if my memory is correct. 

Take a look at the sample and it should all become obvious. 

-----
Jason Judt - Software Engineer
Architecture Technology Corporation
(952) 829 - 5864 x137
jjudt@atcorp.com
 

>  -----Original Message-----
> From: 	Greg Cawthorn [mailto:greg.cawthorn@voxsurf.com] 
> Sent:	Wednesday, January 12, 2005 9:03 AM
> To:	axis-user@ws.apache.org
> Subject:	Extracting attachments from messaging service calls
> 
> Hello,
> 
> I am submitting a SOAP message with an attachment to a web service using
> Axis 1.1. To implement a messaging service I have to use one of the
> following method signatures:
> 
> public Element [] method(Element [] bodies); 
> public SOAPBodyElement [] method (SOAPBodyElement [] bodies); 
> public Document method(Document body); 
> public void method(SOAPEnvelope req, SOAPEnvelope resp); 
> 
> I've chosen to use the last one, but I cannot find a way to retrieve the
> attachment since I only have a reference to the SOAP envelope rather than
> the message itself. Could someone please tell me how I can access the
> entire SOAP message so that I can extract my attachment.
> 
> Thanks,
> 
> Greg