DIME and WS-Attachments specifications evolved to improve on this. DIME is similar to MIME, but is an alternate binary message format that supports the compilation of a message with arbitrary types. Rather than a content type "multipart/related" it is packaged as "application/dime" so that those receiving the message can parse it accordingly. WS-Attachments describes how to encapsulate SOAP message in DIME.
To ultimately answer your question, the Web services toolkits support adding attachments to SOAP messages using an object model, so that you are abstracted from the details of populating HTTP headers and building the compound SOAP message. Thanks to the generation of Web service proxies, in a few lines of code you can create a DIME attachment from a binary stream, attach it to the outgoing attachments collection, and invoke the Web service method, as shown here for a .NET Web service.
DimeAttachment attachment = new DimeAttachment("image/jpeg", TypeFormatEnum.MediaType, data); svc.RequestSoapContext.Attachments.Add(attachment); svc.SignAttachment(text);In short, when you send attachments to a Web service, today's toolkits have standardized on DIME/WS-Attachments. This will likely evolve to accommodate encryption, digital signatures and other features not currently supported, and the names of the standards may even change, but for now this is the way to go.
As a teaser, I have included the links to some newly emerging discussions on SMTOM whose roots derive from PASWA. See below.
For more on DIME/WS-Attachments see the articles titled "Fun with WS-Attachments" and "Getting Started with WSE" at the following link: http://www.dotnetdashboard.net/DesktopDefault.aspx?tabindex=7&tabid=73
This was first published in March 2004