Hi Marcel,
You can rename the file by casting the received dataSource to a
fileDataSource, which is the case when the attachment is cached.. You
can make sure that all the attachments get cached by making the size
threshold zero...

DataHandler dataHandler = (DataHandler)omText.getDataHandler();
FileDataSource fileDataSource = (FileDataSource)dataHandler.getDataSource();
File file = fileDataSource.getFile();
file.renameTo(new File("MyFile.bin"));

For added safety please check for the type before casting..

HTH,
~Thilina

PS: see http://wso2.org/kb/264 for attachment configuration options...

On 12/5/06, Marcel Casado <[EMAIL PROTECTED]> wrote:
Hi Martin,

I got it working on the client adding this properties on the client stub


_operationClient.getOptions().setProperty(Constants.Configuration.CACHE_ATTACHMENTS,
Constants.VALUE_TRUE);

_operationClient.getOptions().setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,
"/Users/marcel/metvaultTemp");

_operationClient.getOptions().setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD,
"4000000");

 Is there a way to have control of the name of the file instead of the
one that the  Axis2 gives by default so you can open the attachment later?

Thanks,

Marcel

Martin Gainty wrote:
> Hello Marcel
>
> I would start with <parameter name="cacheAttachments
> embedded in axis2.xml
> URL is located here
> http://ws.apache.org/axis2/1_0/mtom-guide.html#41
>
> Does this help?
> M-
> This e-mail communication and any attachments may contain confidential and 
privileged information for the use of the
> designated recipients named above. If you are not the intended recipient, you 
are hereby notified that you have received
> this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its
> contents
> ----- Original Message -----
> From: "Marcel Casado" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Monday, December 04, 2006 3:20 PM
> Subject: MTOM && FILE CACHING
>
>
>
>> Hi,
>>
>> Could  anybody send me a code snipped  of using  MTOM && File Caching .
>> What I mostly need  is how to deal with the cached file.  I have a
>> client that receives a MTOM attachment  and  I want  to be  saved  in a
>> file  using the caching mechanism  and  then be able to access to the
>> file later.
>>
>> Thanks,
>>
>> -Marcel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to