In the following the SOAPTest service exposes a method testAttachement that send a SOAP message with attachement.
The following client call that method, takes the part and delete the file. I don't know if it is what you want but it works fine.




public static void main(String [] args) {
try {
String endpoint = "http://localhost:8080/axis/services/SOAPTest?wsdl";;
Service service = new Service();
Call call = (Call) service.createCall();
java.net.URL url = new java.net.URL(endpoint);
call.setTargetEndpointAddress(url);
call.setOperationName("testAttachement");
call.setMaintainSession(true);
String ret = (String)call.invoke(new Object[]{});
org.apache.axis.Message rspMsg= call.getResponseMessage();
java.util.Iterator iter = rspMsg.getAttachments();
while (iter.hasNext()){
org.apache.axis.attachments.AttachmentPart part = (org.apache.axis.attachments.AttachmentPart)iter.next();
java.io.File file = new java.io.File(part.getDataHandler().getName());
//
// Do something with the file
//
file.delete();
}
} catch (Exception e) {
System.err.println(e.toString());
e.printStackTrace();
}
}



Cheers, Patrick.


Subhendu Kumar mohanty wrote:


Even if I can not change the directory .

What will happen if the job is deleting when somebody is requesting for the image.

Is this a limitation of using data handler for attachment in the client side ?

Thanks,
Subhendu

-----Original Message-----
From: BLIS Webmaster (Patrick Houbaux)
[mailto:[EMAIL PROTECTED]
Sent: Monday, July 14, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Axis attachment file created in the Temp directory


I guess you have to clean it or move it somewhere else in your client code.


Patrick.

Subhendu Kumar mohanty wrote:



Hi all,

I am developing a webservice client which uses Axis. My client app calls an external webservice to get the image.I found that Axis creates temporary files in the system default temporary directory and does not clean up.

If anybody has solved this problem please let me know.

Thanks,
Subhendu











Reply via email to