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 Marcel Casado <ma...@ucar.edu> on 2006/12/04 21:20:12 UTC

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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: MTOM && FILE CACHING

Posted by Thilina Gunarathne <cs...@gmail.com>.
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 <ma...@ucar.edu> 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" <ma...@ucar.edu>
> > To: <ax...@ws.apache.org>
> > 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: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: MTOM && FILE CACHING

Posted by Martin Gainty <mg...@hotmail.com>.
Hi Marcel

did you see how the file is passed in thru commandLineOption inside
/src/modules/samples/mtom/src/sample/mtom/client/Client.java
but if you create your own file object and assuming you supply a valid destination you can then call
transferFile(file,destination)

dims?

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" <ma...@ucar.edu>
To: <ax...@ws.apache.org>
Sent: Monday, December 04, 2006 8:10 PM
Subject: Re: MTOM && FILE CACHING


> 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" <ma...@ucar.edu>
>> To: <ax...@ws.apache.org>
>> 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: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>>>     
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>

Re: MTOM && FILE CACHING

Posted by Marcel Casado <ma...@ucar.edu>.
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" <ma...@ucar.edu>
> To: <ax...@ws.apache.org>
> 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: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>     


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: MTOM && FILE CACHING

Posted by Martin Gainty <mg...@hotmail.com>.
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" <ma...@ucar.edu>
To: <ax...@ws.apache.org>
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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>