Generate Code and Manipulate the Attachment
Use rwsfgen to generate code for this project. (For information on how to generate code, see Invoking the Generator.) If you use the provided HydraExpress project file example-project.xml, HydraExpress places the generated code into a code generation directory MIMEExample.
In the client and server sample implementations, HydraExpress generates service operation methods that take as parameters instances of rwsf::MessageAttachment.
The resulting code differs depending on whether the attachment is referenced or unreferenced:
*Referenced attachments are used when WSDL bindings contain a mime:content element, naming the part to be the message attachment. Since the full part is known to be an attachment, the generated code can use rwsf::MessageAttachment to represent the part in the generated client and server implementations. The generated service operation methods use rwsf::MessageAttachment as the part's type.
*Unreferenced attachments do not have a mime:content element; rather, only a soap:body element represents the actual SOAP message. In this design, the attachment is added to the message and parsed separately, but is not referenced as a SOAP message part.
Instead, another method is used to reference the attachment, the WS-I Attachments Profile 1.0 swaRef type identified above. In this case, the code generator creates simple types as the parts in the generated service operation methods. The part that includes the swaRef type will have standard accessors available to retrieve the reference link. To access the attachment, use the getResponseAttachment() method on rwsf::CallInfo with the reference link provided in the swaRef field (Retrieving an Unreferenced Attachment).