uCosminexus Application Server, Web Service Development Guide
This subsection describes the precautions for mapping the SOAP Message from the attachment.
A MIME part consists of 1 root part and 0 or more attachment parts.
The root part is coded at the beginning of the MIME part. After the root part, the attachment part is coded.
The arguments and return values specified in the Java interface are mapped in the attachment part. The following table describes the relationship between the contents specified in the Java interface and the coding order in the attachment part:
Table 28-8 Contents specified in Java interface and coding order of the attachment part
| No. | Location for specifying in Java interface | Coding order of the attachment part |
|---|---|---|
| 1 | Method argument | Coded in the order specified in the method argument. |
| 2 | Method return value | Coded at the beginning of the attachment part. |
| 3 | Array type | Coded in the order of the elements in the array. |
| 4 | User-defined type | Coded in the order of specification of the user-defined type. When specifying the Java type of attachments using the user-defined types specified in the user-defined types, the attachment parts are coded in the depth first order. |
The following is an example of mapping the Java interface and attachment parts:
Figure 28-5 Example of mapping the Java interface and attachment parts
The Content-Id of the corresponding attachment part is coded in the CID URL scheme that is coded in the SOAP Body of the root part. The corresponding attachment part is referenced from the root part using the Content-Id.
The following are some of the SOAP Messages with attachments. The part in bold is the CID URL scheme and the Content-Id of the corresponding attachment part.
--uuid:73a28380-5de5-45e8-af15-c879e65d62a0 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>cid:d10ed73c-e9b7-418e-8201-ba920cccb214@jaxws.cosminexus.com</in0> </getUserData> </S:Body> </S:Envelope> --uuid:73a28380-5de5-45e8-af15-c879e65d62a0 Content-Id:<d10ed73c-e9b7-418e-8201-ba920cccb214@jaxws.cosminexus.com> Content-Type:text/plain Content-Transfer-Encoding:binary Attached-data --uuid:73a28380-5de5-45e8-af15-c879e65d62a0-- |
The following table describes the mapping between the attachment extensions and the MIME types set by default:
Table 28-9 Correspondence table of attachment extensions and MIME types
| No. | Attachment extensions | Set up MIME types |
|---|---|---|
| 1 | html, htm | text/html |
| 2 | txt, text | text/plain |
| 3 | gif, GIF | image/gif |
| 4 | ief | image/ief |
| 5 | jpeg, jpg, jpe, JPG | image/jpeg |
| 6 | tiff, tif | image/tiff |
| 7 | xwd | image/x-xwindowdump |
| 8 | ai, eps, ps | application/postscript |
| 9 | rtf | application/rtf |
| 10 | tex | application/x-tex |
| 11 | texinfo, texi | application/x-texinfo |
| 12 | t, tr, roff | application/x-troff |
| 13 | au | audio/basic |
| 14 | midi, mid | audio/midi |
| 15 | aifc | audio/x-aifc |
| 16 | aif, aiff | audio/x-aiff |
| 17 | wav | audio/x-wav |
| 18 | mpeg, mpg, mpe | video/mpeg |
| 19 | qt, mov | video/quicktime |
| 20 | avi | video/x-msvideo |
If extensions that do not exist in this table are specified, 'application/octet-stream' is set in the MIME type.
When the attachment data size specified in the Java interface is null and when data of 0 or more bytes exists, the method of mapping to the attachment part differs. The following points describe the mapping in each of the cases:
When the attachment data size is null, the attachment data size is not mapped to the attachment part. Only the SOAP Envelope is coded without generating the MIME part. Also, an empty element is specified in the element of the relevant argument of the SOAP Body.
The following is an example of mapping when the attachment data size is null:
... UserInfoService service = new UserInfoService(); UserInfo impl = service.getUserInfo(); result = impl.getUserData( null ); ... |
<?xml version="1.0" ?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <getUserData xmlns="http://localhost"> </getUserData> </S:Body> </S:Envelope> |
When the attachment data size is 0 or more bytes, the attachment data size is mapped to the attachment part. In this case, the root part and attachment part together form the multi part. When multiple attachments are specified in the Java interface, multiple attachment parts are coded. However, for 0 bytes, the MIME body inside the attachment part is empty.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.