Many services use attachments to send and receive data that is not well represented with XML messages (for example, multimedia binary data).SOAtest and Virtualize can be used to send and receive attachments along with messages. Received attachments can then be processed and validated for correctness.
TheSOAP Client and Virtualize Message Responder tools can be configured to send MIME, DIME, and MTOM attachments along with the message. Attachment encapsulation format can be configured under the tool’s Misc (SOAtest) or Options (Virtualize) tab.
With MIME/DIME, the tool’s Attachment tab allows you to send either Binary or XML attachments without scripting as described in the SOAtest Attachment Options and Virtualize Attachment Tab.With MTOM, you do NOT need to add anything to the Attachment tab (see below for details).
The Attachment Handler tool can be used in conjunction with aSOAP Client or Message Responder to extract and validate attachments from a response message. For more information on configuring the Attachment Handler tool, see Attachment Handler.Virtualize will ignore all incoming message MIME parts except the root part (which contains a SOAP envelope). Therefore, it is not possible to configure message correlations or other actions on these parts. However, responses can include any MIME/DIME/MTOM content as configured in the Message Responder
MTOM/XOP MessagesSOAtest and Virtualizecan work with services leveraging the MTOM (Message Transmission Optimization Mechanism) and XOP (XML-binary Optimized Packaging) technologies. You can elect the binary content to include—as well as validate, send and receive—optimized messages.
MTOM optimized messages can be sent using the SOAP Client or Message Responder in Form Input view.
The XOP optimization is performed by replacing the xsd:base64Binary element contents with a reference that looks similar to the following:
< xop:Include href="cid:1.urn:uuid:[email protected]" xmlns:xop="http://www.w3.org/2004/08/xop/include" />
The same href cid value is used in a --MIME_boundary section, which would include the corresponding non-encoded content.
To enable the sending of optimized messages, complete the following:
Click on the tool'sMisc. or Optionstab and choose Custom from the Attachment Encapsulation Format drop-down menu.
- Enable either MTOM Always or MTOM Optional
- MTOM Always: This tool will always send the request in a XOP Package (i.e. with MIME boundaries)—even when there is not optimized content in the request (i.e. even when xsd:base64Binary XML types are not present in the message).
MTOM Optional: This tool will send the request in a XOP Package (i.e. with MIME boundaries) only when there is optimized content in the request. In the absence of optimized content, it will send a normal request.
Note that MTOM Always or MTOM Optional can be selected at thetest or Responder suitelevel in the SOAP Client Options tab or in the SOAP Client page of the Preferences panel.
Select the Request or Request tab and make sure Form Input is selected from the Views menu. The Form Input view is a schema-aware view. In this view, the xsd:base64Binary schema datatype will be recognized so that you can reference the content that you want to optimize. When you click on a base64Binary type, the following options are available:
Reference to file: This is the recommended option. This option allows you to select a file to send as optimized content.SOAtest and Virtualize readthe contents from the file as the contents are being sent on the wire. This way, the file contents are not stored in the suite.
- Persist As Relative Path: It is always recommended that the path to the file be kept as a relative path to the suite to allow for easier sharing and collaboration with the rest of the organization.
- Import from file: This option (not recommended) allows you to read the contents in from the file. This option is not recommended for big files because the contents of the file will be loaded in to memory.
Additionally, the file to be sent can be driven by data sources by selecting Parameterized from the drop down box and selecting a File Data Source. For more information about File Data Sources, seeConfiguring a File Data Source in SOAtest or Configuring a File Data Source in Virtualize.
When you are using MTOM, you do NOT need to add anything to the SOAP Client’s or Message Responder's Attachment tab.Note that incoming MIME attachments can be extracted by chaining an Attachment Handler to the Message Responder's Incoming Attachment output. This is described in Adding Attachment Handlers to the Message Responder.