uCosminexus Application Server, Web Service Development Guide
This subsection describes the notes on mapping attachments to SOAP messages.
A MIME part has one route part and none or more attachment parts.
The route part is defined in the beginning of the MIME part. After the route part, the attachment part is defined.
In the attachment part, the arguments or return values specified in the Java interface are mapped. The following table describes the mapping between the contents specified in the Java interface and the definition sequence in the attachments.
Table 30-9 Contents specified in the Java interface and the definition sequence in the attachment part
| No. | Contents specified in the Java interface | Definition sequence in the attachment part |
|---|---|---|
| 1 | Method arguments | Defined in sequence as specified in the method arguments. |
| 2 | Method return values | Defined in the beginning of the attachment part. |
| 3 | Array type | Defined in sequence of the elements within the array. |
| 4 | User definition type | It is defined in order specified inside the user-defined type. When specifying the Java type of the attachment in the user-defined type inside the user-defined type, the attachment part is defined by depth-based priority order. |
The following figure shows an example of mapping the Java interface to the attachment part.
Figure 30-3 Java interface and attachment mapping: Example
When the attachment is of MTOM/XOP specification format, the XOP information set defined in the XOP specifications is used for mapping the route part to the attachment. The XOP information is coded in the SOAP body of the route part, and the Content-Id of the corresponding attachment is set. The corresponding attachment can be referenced from the route part by the Content-Id. The following is an example of referencing an attachment from the route part. The bold portion indicates the CID URL schema and the Content-Id of the corresponding attachment.
-uuid:e63fe7dc-ad8a-4fb1-8f56-ce7b5841a06f
Content-Type: text/xml
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<getUserData xmlns="http://localhost">
<in0>
<xop:Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:39820675-44bb-4e28-9926-577bf27fa07c@jaxws.cosminexus.com"/>
</in0>
</getUserData>
</S:Body>
</S:Envelope>
--uuid:e63fe7dc-ad8a-4fb1-8f56-ce7b5841a06f
Content-Id:<39820675-44bb-4e28-9926-577bf27fa07c@jaxws.cosminexus.com>
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
[attached data]
--e63fe7dc-ad8a-4fb1-8f56-ce7b5841a06f--
|
The format of the XOP information set defined in the SOAP body of the route part is as follows:
"<xop: Include href=" + CID URL-schema + "/>" |
The method of mapping the attachments in MTOM/XOP specification format to the attachment part differs according to the data size of the attachment specified in the Java type and the Java interface of the mapping source. The following table lists various mapping methods.
Table 30-10 Mapping the MTOM/XOP specification format attachments to the attachment part based on the data size
| No. | Java type | Data size of the attachment | Mapping to the attachment part |
|---|---|---|---|
| 1 | byte[] | null | Mapping is not done#1 |
| 2 | 0 byte data | Mapping is done#2 | |
| 3 | Data bigger than 0 bytes | Mapping is done#3 | |
| 4 | java.awt.Image type | null | Mapping is not done#1 |
| 5 | 0 byte data | Mapping is not done#1 | |
| 6 | Data bigger than 0 bytes | Mapping is done#3 | |
| 7 | javax.xml.transform.Source type | Null | Mapping is not done#1 |
| 8 | 0 byte data | Mapping is done#2 | |
| 9 | Data bigger than 0 bytes | Mapping is done#3 | |
| 10 | javax.activation.DataHandler type | null | Mapping is not done#1 |
| 11 | 0 byte data | Mapping is done#2 | |
| 12 | Data bigger than 0 bytes | Mapping is done#3 |
... UserInfoService service = new UserInfoService(); UserInfo impl = service.getUserInfo(new MTOMFeature()); result = impl.getUserData( null ); ... |
--uuid:cbc0221b-8ee3-40a3-adc1-d5fa52a8d66e
Content-Id: <rootpart*cbc0221b-8ee3-40a3-adc1-d5fa52a8d66e@jaxws.cosminexus.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getUserData xmlns:ns2="http://localhost">
</ns2:getUserData>
</S:Body>
</S:Envelope>
--uuid:cbc0221b-8ee3-40a3-adc1-d5fa52a8d66e--
|
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.