axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dorner Thomas <Thomas.Dor...@t-systems.com>
Subject SOAP with Attachments ?
Date Tue, 10 Aug 2004 15:06:35 GMT
Hello all,

I like to send an attachment from my Service to the client.
So there are several possible ways to go:

The first ist to place a attachment in the responseMessage:

String fileName = "C:\\WebService\\webapps\\PDMWebConnector\\arrow.gif";

//explicitly set format to DIME, default is MIME
Message rspmsg = AxisEngine.getCurrentMessageContext().getResponseMessage();
rspmsg.getAttachmentsImpl().setSendType(org.apache.axis.attachments.Attachme
nts.SEND_TYPE_DIME);

DataHandler dh = new DataHandler(new FileDataSource(fileName));
if (dh == null ) System.err.println("dhSource is null");
AttachmentPart ap = new AttachmentPart(dh);

rspmsg.addAttachmentPart(ap); 


The other way is to send back the datahandler itself


public Datahandler download(java.lang.String request) throws
java.rmi.RemoteException {
...


The difference is in the SOAP-Message. If I send a Datahandler back,
I got a SOAP-Message with a href in my SOAP-Body, referencing the 
Attachment behind my SOAP-Message.

In the other way, when I send back the added AttchmentPart, I got no
reference in my
SOAP-Body. 

Whats the right way to go???
Is there a solution to place Filename or addional information when I send a
Datahandler?

Please help me!

I wanna send Data from a Java-Service to a gsoap Client!!!

Thanks Tomi

Mime
View raw message