A service is created that accepts a soap with attachment (DocumentService) and translates it to a service that accepts a binary element. MTOM is used for performance reasons for the second.
* For the use of attachments you need RPC-style document instead of the usual document-style. This due to the fact that the document-style limits a message to a single
* A service can not have both SWA and MTOM within OSB.
First a WSDL is setup for the DocumentService:
The $attachments variable holds the attachments and the body holds the attachment data. Also other data is stored within the attachment element (see here). In the case of a binary attachment (as described within this post), this data is not put in the body element. Instead the Oracle Service Bus run time stores it in an in-memory hash table and a reference to that content is inserted into the XML (binary-content element).
Then you can use the OSB Test console to send an attachment and view the attachment variable.
Now the business service wsdl is defined and configured. The following WSDL is used.
We now define the business service that uses MTOM/XOP as transport protocol. Make a WSDL Web Service with the previous defined WSDL. In the transport properties just use http://localhost:7001/ecm as the endpoint, leave HTTP transport properties the default. In the Message Content you can set the MTOM/XOP enabling of the format. You have two possibilities (I will show both options). First select the "Include Binary Data by Value".
- Include Binary Data by Reference: (Default) In an outbound response message, replace
ctx:binary-contentelements when setting up the $body message context variable.
- Include Binary Data by Value: In an outbound response message, replace
xop:Includeelements with Base64-encoded text versions of corresponding binary data when setting up the
$body messagecontext variable.
We add a Replace (Replace Node Contents) of the $body variable after the Assign.
tcpmon which is a HTPP monitoring tool.
Run the tool and set it up by listening on port 8090. Click Add Monitor.
The MIMI boundary contains the actual binary data.
Include Binary Data by Reference
Now change the Message Content configuration of the business service to Include Binary Data by Reference and run the test tool again. You will notice that in this case the result is the same.