Hi Thomas,
You can use any of the form u want. But I
dont know how your gsoap client will handle it. It is better if you use the
first way (Using Attachment Parts), where the attachment doesnt have a reference
in the SOAP Body. Here the one good thing u never need to modify ur
WSDL.
When u use the Datahandler way( In line
form), the experts say that there can be a problem when u send huge files as
attachemnts. Also u need to have the return parameters described in the WSDL. Of
course u can set the filename in the Datahandler itself.
But I dont think setting the filename is
a problem in the AttachmentParts way . You can set this in the SOAP Header of
the SOAPMessage using some handlers.
Please refer the following mail archives
Cheers
Dhanush Gopinath Software
Engineer Mahindra British Telecom Ltd +91-020-4018100
Ext:-1218
"It's the possibility of having a dream come true , that makes life
interesting" - Paulo Coelho, The Alchemist
----- Original Message -----
Sent: Tuesday, August 10, 2004 8:36
PM
Subject: SOAP with Attachments ?
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
********************************************************* Disclaimer:
This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
********************************************************* Visit us at http://www.mahindrabt.com
|
|