uCosminexus Application Server, Web Service Development Guide
This section describes the Java type that is used for specifying an attachment in a Java interface.
All the Java types, which are mapped to the Base64 format data of the following items, are targeted for the attachments in the MTOM/XOP specification format:
If there are multiple Java types, which are mapped to the Base64 format data, you cannot specify only a particular Java type as the target of the attachments in the MTOM/XOP specification format.
Following annotations are used in an attachment in MTOM/XOP specification format:
Annotate the javax.xml.ws.soap.MTOM annotation in the Web Service implementation class to use the MTOM/XOP specification format attachments in the Web Service. The following is an example of a Web Service implementation class that uses the attachments in MTOM/XOP specification format:
package com.sample;
@MTOM
@BindingType(...)
public class UserInfoImpl implements UserInfo {
public UserData setUserData(Image image)
throws UserDefinedException {
......
}
}
|
You can also use the attachments in MTOM/XOP specification format by specifying the field value of the javax.xml.ws.soap.SOAPBinding interface in the javax.xml.ws.BindingType annotation instead of the javax.xml.ws.soap.MTOM annotation. The following table describes the relation between the field values of the javax.xml.ws.soap.SOAPBinding interface specified in the javax.xml.ws.soap.MTOM annotation and the javax.xml.ws.BindingType annotation.
Table 30-1 Relation between the MTOM annotation and SOAPBinding interface fields
| No. | MTOM annotation | BindingType annotation | MTOM/XOP type attachment | ||
|---|---|---|---|---|---|
| If annotated | enabled element value | SOAPBinding interface field value | Availability of the field value | ||
| 1 | YES | true | SOAP11HTTP_BINDING | YES | Y |
| 2 | SOAP12HTTP_BINDING | YES | Y | ||
| 3 | SOAP11HTTP_MTOM_BINDING | YES | Y | ||
| 4 | SOAP12HTTP_MTOM_BINDING | YES | Y | ||
| 5 | false | SOAP11HTTP_BINDING | YES | N | |
| 6 | SOAP12HTTP_BINDING | YES | N | ||
| 7 | SOAP11HTTP_MTOM_BINDING | NO# | -- | ||
| 8 | SOAP12HTTP_MTOM_BINDING | NO# | -- | ||
| 9 | NO | -- | SOAP11HTTP_BINDING | YES | N |
| 10 | SOAP12HTTP_BINDING | YES | N | ||
| 11 | SOAP11HTTP_MTOM_BINDING | YES | Y | ||
| 12 | SOAP12HTTP_MTOM_BINDING | YES | Y | ||
The following is an example of a Web Service implementation class that uses the field values of the javax.xml.ws.soap.SOAPBinding interface instead of the javax.xml.ws.soap.MTOM annotation:
package com.sample;
@BindingType(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
public class UserInfoImpl implements UserInfo {
public UserData setUserData(Image image)
throws UserDefinedException {
......
}
}
|
In a Document Bare style Java class, if you want to link Java type and MIME type by using an attachment in MTOM/XOP specification format, you must not use the Java type as a return value of the service method or as a parameter. To link Java type and MIME type, use Java type in the user-defined type field and annotate the getter method of that field with the javax.xml.bind.annotation.XmlMimeType annotation.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.