How to change the content-type of the attachments when using MTOM attachments in Service activity?

How to change the content-type of the attachments when using MTOM attachments in Service activity?

book

Article ID: KB0092976

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
By default, BW hardcodes the content-type of MTOM attachments to octet-stream. BW will provide an option so that users can change the content-type of the attachments when using MTOM in Service activity. This has been fixed in BW 511 hotfix 16. To make it work with BW 511 hotfix 16, follow instructions in the Resolution section of this article.

Issue/Introduction

How to change the content-type of the attachments when using MTOM attachments in Service activity?

Resolution

1).  Add "xmlmime.xsd" file into your project. (You can copy it from the attached project, filename: Service_MTOM.zip).
2). In your WSDL/schema, change the binary element type as follows. (Picture is the element for the sample project).

<xs:element ns1:expectedContentTypes="application/octet-stream" name="picture" minOccurs="0">
<xs:annotation>
<xs:documentation>Binary attachment e.g. a PDF or image.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute ref="ns1:contentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

3). After the above change, you will be able to see the contentType. (See attached filename: content-type.png)
4). Fill the value with your preferred content type value.
5). Run the project and you can see changed content type (See attached filename: tcp_trace.png).
6). The same can be done at the client side (soaprequestreply).

Attachments

How to change the content-type of the attachments when using MTOM attachments in Service activity? get_app
How to change the content-type of the attachments when using MTOM attachments in Service activity? get_app
How to change the content-type of the attachments when using MTOM attachments in Service activity? get_app