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 Dorner Thomas <Th...@t-systems.com> on 2004/08/12 17:24:09 UTC

Interoperability problem wit Attachments ?

Hi all, hi Dhanush,
 
Thank you Dhanush for you reply.
 
After a few days of testing to send a attachment with DIME from AXIS-Service
to gsoap-client,
we are really down. SO I hope someone can give us a hint.
 
First of all, we send from the Service:
 
Message rspmsg = AxisEngine.getCurrentMessageContext().getResponseMessage();
rspmsg.setMessageType(org.apache.axis.Message.MIME_APPLICATION_DIME);
 
DataHandler dh = new DataHandler(new FileDataSource(fileName));
AttachmentPart ap = new AttachmentPart(dh);
 
MessageContext context=MessageContext.getCurrentContext();
Message responseMessage = context.getResponseMessage();
responseMessage.getAttachmentsImpl().addAttachmentPart(ap);
 
The difference is, that gsoap only know the pratice of sending the
attachments by a Data-typ!?
If you look at a gsoap SOAP-Trace, when sending a attachment, there is a
href:cid:... as attribute in the response-Element
of the SOAP-Body, referencing the attachment.
 
This is the same prytice as sending a Datahandler in AXIS.
 
Can someone please tell me if it is possible to send a attachment from AXIS
to gsoap?????????
--> A YES or NO would be enough
 
Can someone pls tell me whats the right way of making this working?????????
Short hints would be wonderfull - please!!! :)
 
It is very interesting for us, if someone before make this working????
 
Thanks for help
 
Tomi
 
 
 
 
 
 
 
 
 
 
 
 

-----Ursprüngliche Nachricht-----
Von: Dhanush Gopinath [mailto:dhanush@mahindrabt.com]
Gesendet: Mittwoch, 11. August 2004 07:54
An: axis-user@ws.apache.org
Betreff: Re: SOAP with Attachments ? 


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 
 
http://www.mail-archive.com/axis-user@xml.apache.org/msg20064.html
<http://www.mail-archive.com/axis-user@xml.apache.org/msg20064.html> 
 <http://www.mail-archive.com/axis-user@xml.apache.org/msg08732.html>
http://www.mail-archive.com/axis-user@xml.apache.org/msg08732.html
 
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 ----- 
From: Dorner Thomas <ma...@t-systems.com>  
To: 'axis-user@ws.apache.org' <mailto:'axis-user@ws.apache.org'>  
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