Someone who's coming along to my .NET Exchange User Group presentation in Ipswich tomorrow night contacted me about finding a .NET implementation that handles SOAP with Attachments. Here's some background and a possible solution (let me know if there's a better one).
The Problem
He needs to write a client to consume a web service provided by a finance group that are using Java to publish their messages in the SOAP Messages with Attachments (SwA) specification. The frustration for his company is that even though Microsoft was a co-author on this specification they provide no implementation that supports SwA. Omri Gazitts, an Indigo Program Manager has the definitive explanation about why Microsoft has co-authored four SOAP attachments specifications. Dave Bettin has also been asking good questions about this issue. Basically the requirements have changed as time progressed. The main problems with SwA are that it uses MIME which provides no message header length so that the whole message stream must be parsed to find a text boundary between attachments, which is slow, and it doesn't work well with SOAP Headers which makes it hard to integrate with other WS-* specs such as WS-Security.
Omri has another post that explains the future, which is MTOM that will be backward compatible with SwA. Unfortunately as Omri says 'we have no plans to support "vanilla" SwA at this time, given that it neither imposes an infoset data model nor is as efficient as DIME - in other words it's the worst of both worlds'. Where does this leave people like my colleague who need to consume a web service that uses SwA in the wild?
Possible Solution
Well, there is an MSDN magazine article from two years ago that has a lightweight SoapExtension implementation to convert SwA messages into a single SOAP message with the attachments written out as elements inside the SOAP Body (thanks to fellow RD, Christian Weyer for pointing me to this). It's not too much trouble to convert this SoapExtension to work on the client. The other part of the problem is an improved MIME parser. I found the cpShere Email component project on GotDotNet provides this. With these two parts I think it's possible to kludge together something that works while we wait for a .NET implementation of MTOM in future.
If anyone has implemented or knows of a better .NET solution please let me know.