Oracle Service Bus 12C:  Enabling Attachment Support

Oracle Service Bus 12C: Enabling Attachment Support

Oracle Service Bus (OSB) 12C has been simplified by enabling creation and modification of services right inside JDeveloper, alongside SOA development.  However, this has introduced a learning curve for developers to learn and adapt to OSB development using JDeveloper IDE.  A common use case for OSB service development is to allow attachments to pass through as part of the response.  In this post, we discuss about how it can be done in OSB 12C using JDeveloper.

Unlike SOA web service adaptors, OSB does not support attaching MTOM policy (oracle/wsmtom_policy) to the proxy or business services.

1

At design time, JDeveloper doesn’t restrict usage of MTOM policy, and it will compile without any errors. However, when the service is deployed, it will fail with the following error:

“[OSB-387177]OWSM Policy oracle/wsmtom_policy is not supported.”

To get our use case working, three steps are required.  The first is to remove the attached MTOM policies from the Proxy and Business services.  This will ensure there are no deployment failures.

The second change should be in the pipeline.  Open the pipeline and switch it to the “Configuration” view (the default is “Design” view).  Then, go to the “Message Handling” sub-tab and select the checkbox:  “XOP/MTOM Support”.

2

The third and final change required is in the Business Service.  Open the Business Service and go to the “Message Handling” sub-tab.  Select the checkbox:  “XOP/MTOM Support”.  Here, select the appropriate option, depending on whether you want an attachment (Include Binary Data by Reference) or inline data (Include Binary Data by Value).

3

After completing this configuration, the compilation and deployment will proceed without any issues.

Note: The output structure should be defined in XML schema with base64Binary as the element type. Here is a sample type definition:

If you have any questions or comments, please leave them below and we’ll get back to you!

Tagged with: , , , , , , , ,
5 comments on “Oracle Service Bus 12C: Enabling Attachment Support
  1. Jimish says:

    Hello
    I have a requirement where destination system accepts data into base64ibinary data type. I am trying to replicate by creating a stub/mock service.

    can you please suggest how do I define xsd & map normal xml to base64binary data type?

    • astblogsadmin says:

      Jimish,

      Thank you for your inquiry. Our team is working on an effective response and will have something for you by the end of this week.

    • astblogsadmin says:

      Jimish,

      You should have the target system’s schema, which you can use to create the mock service. In general, to define base64 type data, you can define the element as xsd:element name="xmlData" type="xsd:base64Binary"/. You can then create a WSDL and create a mock service out of it.

      To convert XML data to base64Binary, you will have to use a java callout in OSB or embedded java coding in BPEL.

      As always, if you have any further questions, please do not hesitate to ask.

      • Ankith says:

        Hi,

        I have a same requirement where i need to send binary data(as an ttachment) to target system means convert XML into base64binary, what i did was i have enabled MTOM option in pipeline am confused of what to be done next to send base64binary to target system.

        Thanks
        Ankith

        • astblogsadmin says:

          Ankith,
          Enabling the MTOM option and having base64Binary in payload is enough to send data as attachment. You may test the process using a tool like SoapUI and see the results.

Leave a Reply

Your email address will not be published. Required fields are marked *

*