Manu
Manu

Reputation: 29153

How do I encode a binary MIME attachment in C#?

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?

Upvotes: 2

Views: 2474

Answers (4)

markt
markt

Reputation: 5156

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.

Upvotes: 1

Manu
Manu

Reputation: 29153

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

Upvotes: 2

C. Ross
C. Ross

Reputation: 31868

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.

Upvotes: 0

Lloyd
Lloyd

Reputation: 29668

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

Upvotes: 1

Related Questions