uCosminexus Application Server, Web Service Development Guide

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

16.2.20 javax.xml.ws.soap.MTOM annotation

Specify the javax.xml.ws.soap.MTOM annotation in the Web Service that uses the attachments of MTOM/XOP specification format.

The description of the javax.xml.ws.soap.MTOM annotation is as follows.

Web Services
You can specify the javax.xml.ws.soap.MTOM annotation only in the Web Service Implementation Class. The annotation is ignored if specified in SEI. Also, the operation is not guaranteed if the annotation is specified in the Provider Implementation Class (class that implements the javax.xml.ws.provider interface).

Web Services client
You can specify this annotation in the setter method or a field that injects the port. For details, see 10.21.1(4) Enabling features. The annotation will be ignored if you specify the annotation in any other fields or methods.

When creating the Web Service that uses attachments of MTOM/XOP specification format with the help of the skeleton class of the Web Service Implementation Class generated by the cjwsimport command, the javax.xml.ws.soap.MTOM annotation is not mapped in the skeleton class of the Web Service Implementation Class. Therefore, you must specify the javax.xml.ws.soap.MTOM annotation. Note that even if the javax.xml.ws.soap.MTOM annotation is specified in the Web Service Implementation Class, an element or attribute indicating the usage of attachments of MTOM/XOP specification format does not appear in the WSDL file issued by the Web Service JAX-WS engine or WSDL file generated by the cjwsgen command.

The javax.xml.ws.soap.MTOM annotation is referenced only when starting the Web Services. Therefore, this annotation is not interpreted when executing the apt command and the cjwsgen command.

The following is an example using the javax.xml.ws.soap.MTOM annotation in Web Service:

.......
@MTOM
@WebService(endpointInterface = "jaxwstp.example.service.ExamplePortType", targetNamespace = "http://service.example.jaxwstp/", serviceName = "ExampleService", portName = "ExamplePort")
public class ExampleBinding implements ExamplePortType {
Organization of this subsection
(1) enabled element (javax.xml.ws.soap.MTOM)
(2) threshold element (javax.xml.ws.soap.MTOM)

(1) enabled element (javax.xml.ws.soap.MTOM)

The enabled element specifies whether to use the attachments of MTOM/XOP specifications format in the Web Service. When true is specified, attachments of MTOM/XOP specifications format can be used, and when false is specified, attachments of MTOM/XOP specification format cannot be used. The default value is true.

(2) threshold element (javax.xml.ws.soap.MTOM)

The threshold element is the threshold for sending the binary data as attachments of MTOM / XOP specifications format when you can use attachments of MTOM / XOP specifications format in the Web Service. In classes other than the javax.activation.DataHandler class, for the binary data exceeding the specified value (threshold element value [Figure] size of the data to be sent), binary data is sent as attachments of MTOM/XOP specifications format. The default value is 0.