Doorgaan naar hoofdcontent

OSB 10gR3 and SWA and MTOM

This blog is about using soap with attachments and the use of MTOM within the OSB (10gR3).
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.

Some notes:
* 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.
After the attachment is sent, you can view the content of the attachments variable and it shows the binary reference.

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 xop:Include elements with ctx:binary-content elements when setting up the $body message context variable.
  • Include Binary Data by Value: In an outbound response message, replace xop:Include elements with Base64-encoded text versions of corresponding binary data when setting up the $body message context variable.
Now we call this business service from within the proxy service.
Of course we have to map the document attachment to the bas64Binary element within the business service.
We add a Replace (Replace Node Contents) of the $body variable after the Assign.
If you run this within the test console with a Word attachment (Content-Type: application/word), you get the following invocation tree.
You see a binary-content reference, so you do not actually see what goes over the HTTP transport. Therefore you can use tcpmon which is a HTPP monitoring tool.
Run the tool and set it up by listening on port 8090. Click Add Monitor.

You also need to change the endpoint of the business service so that the message is sent to tcpmon.
Now run the test console again with an attachment. Now you probably get the following error.
It says that mixing attachments with XOP/MTOM is not allowed. This is due to the fact that we did not change the $attachments variable. You have to delete the attachments so we add a Delete after the Replace.
If you now run the test console again with an attachment the tcpmon tool we show you the actual http call and it will look something like this.
You can see that the Post is a application/xop+xml type and the Doc element contains a inc:Include reference.
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.


  1. alexander van der Woude31 augustus 2010 om 14:39

    Hey Roger,

    usefull article. Just what I needed.

    Chck your WSDL though, closing tags are located in wrong place.

  2. Alexander,

    Good that I could help and thanks for the WSDL remark !

  3. Hi Roger,
    thank you very much for your example.

    But I have found a problem with missing the start-info attribute in the Context-Type.

    Without this attribute called ASP.NET MTOM WS returns 400 Bad Request.

  4. Hi Miloslav,
    Thanks for sharing this!

    In which part do you have to add start-info attribute?


  5. There is the Content-Type with missing the start-info attribute in a business service. Also in your image from tcpmon.

    If there is no the start-info attribute the IIS(WSE) MTOM web service returns 400 Bad Request.
    I do not know how to add the attribute to the Content-Type.

    Currently I use an Any SOAP(with MTOM support) proxy that sends request with this attribute from client(SoupUI) and the proxy ONLY sends the request to a business service.
    It works.

    See my business service trace log.
    [OSB Tracing] Outbound request was sent.
    multipart/related; type="application/xop+xml"; start="<>"; start-info="text/xml"; boundary="----=_Part_1_6447144.1284621320422"

  6. Maybe you can have a look at:

    Hope this can help you with changing the Content-Type.

  7. Roger,

    Do you have an example to do this with bpel in a composite?

    Thank You.


  8. Hello if this article is up to date? The WSDL are blanked. I am new to this and this example it is quite difficult to me withou proper WSDL.

  9. From MTOM to SwA is possible, among proxies

  10. Thanks!

    I had an issue and your article connected the DOTS.

    I also had blanked WSDL ... but the WSDL is not the answer to your issues.


Een reactie posten

Populaire posts van deze blog

Microservices mindmap

"The tree" - See also   my photo page When you are fairly new within the Microservices land, there are a lot of terms fired at you. So also for my own understanding i have made a mindmap. I think it has a good status now, so that i can share it with you. As always feedback is very welcome ! You can download the mindmap here .

Book review: Data Management at Scale (Piethein Strengholt)

 This blog is a review of the book "Data Management at Scale (See also at ) Data Management is a hot topic nowadays and this book does a fantastic job at adding value to this topic. It is a must read and one of the few technical books I finished reading in a weekend. The book gives a fantastic overview on how to implement a Data Mesh data architecture. The Data Mesh concept is explained by Martin Fowler here . The book is a good mix between conceptual and implementation architecture level. It gives a lot of examples of how this architecture at scale can work, for both small and big companies. It is practical and I used it to implement it at one of my customers. The book describes an architecture in which the focus is on the DIAL (Data- and Integration Access Layer).  On a high level the book covers the following topics: The key principles for data management at scale - Domain-Driven Design  - Domain Data Stores - Meta data management Ready Data Store The concept of servin

Event Driven Architecture with Oracle EDN

"The flying Dutchman" (see also  photo page ) Key Takeaways Event Driven Architecture helps with decoupling applications Think about the names used for events Let Publisher publish and filter within subscribers Use meta data within event headers Use standardization on entities within Event, so that the Event is a first citizen data object Introduction There is a lot of hype around Microservices and the use of events for implementing the choreography pattern. However this is nice for companies like Netflix and Twitter, but there are a lot of organisations still struggling with files and ESB like products. Also my current client uses an ESB namely the Oracle SOA Suite 12c for integrations. We cannot just throw away this ESB, but we can make use of the event mechanism built in. This blog describes the way we use  the EDN (Event Delivery Network) component, that is used within SOA composites to throw events and to subscribe