uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

30.5.1 Mapping the attachments to the SOAP messages (MTOM/XOP)

This subsection describes the settings required for mapping the attachments to the SOAP messages. For the mapping conventions, also see 30.5.2 Notes on mapping from the attachments to the SOAP messages (MTOM/XOP).

Organization of this subsection
(1) HTTP header
(2) HTTP body

(1) HTTP header

The following table lists the values that are set in the HTTP header field and parameters when attachments in MTOM/XOP specification format are used.

Table 30-6 HTTP header fields and parameter settings

No. Field name Parameter name Settings
1 Content-Type -- "multipart/related" is set.#
2 start Route part Content-Id is set.
3 type "application/soap+xml" is set.
4 boundary MIME part border string is set.
5 start-info

SOAP 1.1 specifications
"text/xml" is set.

SOAP 1.2 specifications
"application/soap+xml" is set.

Legend:
--: Shows that the value is directly set in the Content-Type field.

#
Even if the MIME part is only a route part, or if at least 1 attachment MIME part is used (It is a SOAP message with MTOM/XOP type attachment), you must set "multipart/related".

(2) HTTP body

HTTP body has a route part, an attachment part, and the border strings between each part. This section describes the contents generated in each part and the values set when using the attachments.

(a) Route part MIME header

The following table lists the values that are set in the route part fields when using the attachments.

Table 30-7 Route part fields and parameter settings

No. Field name Parameter name Settings
1 Content-Type -- "application/xop+xml" is set.
2 charset "utf-8" is set.
3 type

SOAP 1.1 specifications
"text/xml" is set.

SOAP 1.2 specifications
"application/soap+xml" is set.
4 Content-Transfer-Encoding None "binary" is set.
5 Content-Id None "rootpart*"+" globally unique value "+"@"+"jaxws.cosminexus.com" is set.

Legend:
--: Shows that the value is directly set in the Content-Type field.

(b) Route part MIME body

When using attachments, SOAP envelope is stored as is in the MIME body of the route part. XOP is used for referencing the MTOM/XOP specification format attachments from the SOAP body that exists inside the SOAP envelope.

(c) Attachment part MIME header

The following table lists the values that are set in the MIME header of the attachment part when using attachments.

Table 30-8 Attachment part fields and parameter settings

No. Field name Parameter name Settings
1 Content-Type -- Text expression of the MIME type specified in the value element of the XmlMimeType annotation is set.#1, #2, #3
2 charset If the target of MTOM/XOP specification format attachments is Source type, "UTF-8" is set.#4
If the target of MTOM/XOP specification format attachments is DataHandler type, the character code specified when generating the DataHandler object is set.#5
If the target of MTOM/XOP specification format attachments is a Java type other than those mentioned above, the parameter does not appear.
3 Content-Transfer-Encoding None "binary" is set.
4 Content-Id None "globally unique value"+"@"+"jaxws.cosminexus.com" is set.

Legend:
--: Indicates that the value is directly set in the Content-Type field.

#1
It is a MIME type set in the Content-Type field. For the "text/xml" and "application/xml" MIME types that represent XML, we recommend "application/xml".

#2
If a MIME type with a parameter is specified in the value element of the XmlMimeType annotation, that parameter is also set in the Content-Type field.

#3
The value set in the Content-Type field changes as follows according to the method used for generating the DataHandler object:
  • If the object is generated in the DataHandler(DataSource) constructor
    In FiledataSource, from the extension of the attachment that is used as an input, the MIME type decided by JAF is set as the value of the Content-Type field.
  • If the object is generated in the DataHandler(Object, String) constructor
    The contents (MIME type) specified in the 2nd argument of the constructor when the DataHandler object is generated is set as is as the Content-Type field value.

#4
If the MIME type specified in the xmime:expectedContentTypes attribute or javax.xml.bind.annotation.XmlMimeType annotation includes charset, the charset value in the Content-Type field will be the charset value included in the specified MIME type.

#5
If the DataHandler object is generated and sent as an MTOM/XOP specification format attachment in the following manner, the charset parameter value Shift_JIS specified in the 2nd argument will be set for the Content-Type charset.
DataHandler dhandler = new DataHandler ("Double byte character", "text/plain; charset=Shift_JIS");

The javax.activation.DataHandler Java type of MTOM/XOP specification format attachment is a JavaBeans Activation Framework(JAF) type same as the javax.activation.DataHandler Java type that can be used as wsi:swaRef format attachment. Hence, you can specify attachment data of any MIME type for the javax.activation.DataHandler type.