Thanks a lot Andreas.
And by the way I forgot to thank you for your help last time with addAttachment.
I found another solution for Content Type:

        MimetypesFileTypeMap map = new MimetypesFileTypeMap();
        map.getDefaultFileTypeMap();
        map.addMimeTypes("application/tar.gz gz");
        map.setDefaultFileTypeMap(map);

I am looking now into another problem. I would like to be in control of the 
Content-Transfer-Encoding. The spec in my project is calling for either binary 
or base64 to be selected. How to do that in SwA type attachment?


Thanks 
Vadim. 
(310)765-3812 

-----Original Message-----
From: Andreas Veithen [mailto:[email protected]] 
Sent: Friday, July 24, 2009 12:13 AM
To: [email protected]
Subject: Re: [axis2] How to set Content Type for SwA type attachment

Vadim,

The content type of the attachment is determined by a call to 
DataSource#getContentType(). The problem is that FileDataSource doesn't allow 
you to set the content type explicitly, but uses some filetype mapping 
mechanism. There is an alternative implementation called "CachedFileDataSource" 
in Axiom that allows you to set the content type yourself.

Regards,

Andreas

On Thu, Jul 23, 2009 at 23:08, Vadim
Letitchevski<[email protected]> wrote:
> I have used "Sample client which sends a message with SwA type attachments"
> code snippet to adjust my Stab generated from WSDL.
> Particularly these strings:
>
>         FileDataSource fileDataSource = new 
> FileDataSource("Name.tar.gz");
>         DataHandler dataHandler = new DataHandler(fileDataSource);
>         _messageContext.addAttachment(myclass.getPartData().getHref(),
> dataHandler);
> There are some things I wish were a bit more manageable.
> Can anyone tell me how to set the attachment Content Type. When I 
> attach file "Name.tar.gz" the automatic selection sets it to 
> "application/octet-stream" where I would like to see "application/tar.gz".
>
>
> Thanks
> Vadim.
> (310)765-3812
>
>

Reply via email to