I was recently working on a project where we had to handle SOAP attachments. Working with SOAP attachments is the kind of thing that you work on every 3-5 years and then 10 seconds after you are done you forget all about them. All the information required is available in our docs but it can still be good to have a complete end to end example as a reference. Esteban Robles Luna’s (former MuleSoft colleague) blogpost, Working with SOAP attachments using Mule’s CXF module, from 2011 was most helpful.
This is probably the most complicated flow since it requires some 4 lines of code in order to create the attachment and uses the CXF module to configure the client piece. Trigger the flow by copying the file src/test/resources/esb.pdf to the folder src/test/resources/soap/attachment/in. The configuration file can be found here:
2. SOAP Attachment – Server
This flow exposes a SOAP web service and retrieves the SOAP attachment from the request and writes that to disk. The service is triggered when triggering the client, if you want to test it it individually just use SOAP UI and point it to the endpoint (http://localhost:8883/contacts). The configuration file for this web service can be found here:
3. REST Attachment – Client
This implementation is very straightforward, just use the attachment message processor and the outbound HTTP call to make the call. You can trigger the flow by copying the file src/test/resources/esb.pdf to the folder src/test/resources/rest/attachment/in. The configuration file for this can be found here:
4. REST Attachment – Server
The REST service accepting is autogenerated using a RAML file that can be found here. The API has some additional methods not used in this example. The example can be triggered by the client described in step 3 by copying the file to the right folder or by any REST console that can take an attachement by posting to this URL: http://localhost:8884/api/contact/abc/datasheet. The configuration for this API can be found here:
MuleSoft provides the most widely used integration platform for connecting any application, data source or API, whether in the cloud or on-premises. With Anypoint Platform®, MuleSoft delivers a complete integration experience built on proven open source technology, eliminating the pain and cost of point-to-point integration. Anypoint Platform includes CloudHub™ iPaaS, Mule ESB™, and a unified solution for API management™, design and publishing.