Enabling Attachment Support in OSB – Oracle Service Bus

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:

<xsd:complexType name=”Document”> <xsd:sequence> <xsd:element name=”docId” type=”xsd:string”/> <xsd:element name=”documentData” type=”xsd:base64Binary”/> <xsd:element name=”documentMimeType” type=”xsd:string”/> </xsd:sequence> </xsd:complexType>

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

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube