views:

850

answers:

5

I need to send a binary attachment to a JAVA webservice via SwA (Soap with Attachments). After discovering that .Net does not support SwA I am writing my own client. How do I encode the binary MIME attachment, so that the Java service will be able to decode it?

+1  A: 

I suggest you look at the various MIME RFC, mostly it uses Base64 which thankfully .NET already handles.

Lloyd
A: 

You may want to look at the System.Net and System.Net.Mime namespaces. Some of the work there may be done for you.
Particularly look at System.Net.Mail.Attachment.

C. Ross
+2  A: 

The answer is: you don't encode it. It is simply added as raw bytes.

Manu
A: 

use the tool from http://www.alotsoft.com

bookreader
A: 

I realize this question is old, but others may be looking for a similar answer.

Are you sure you need to write your own client - .NET WSE has support for MTOM for a long time, and MTOM was designed to be backward compatible with SwA.. I would look into this and try MTOM before attempting to write my own client.

markt