...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="XrayStorage"
targetNamespace="http://mediStor.org/x-rays"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://mediStor.org/x-rays"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd1="http://mediStor.org/types/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<schema targetNamespace="http://mediStor.org/types/"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="xRayType">
<sequence>
<element name="patientName" type="xsd:string" />
<element name="patientNumber" type="xsd:int" />
<element name="imageData" type="xsd:base64Binary" />
</sequence>
</complexType>
<element name="xRay" type="xsd1:xRayType" />
</schema>
</types>
<message name="storRequest">
<part name="record" element="xsd1:xRay"/>
</message>
<message name="storResponse">
<part name="success" type="xsd:boolean"/>
</message>
<portType name="xRayStorage">
<operation name="store">
<input message="tns:storRequest" name="storRequest"/>
<output message="tns:storResponse" name="storResponse"/>
</operation>
</portType>
<binding name="xRayStorageSOAPBinding" type="tns:xRayStorage">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="store">
<soap12:operation soapAction="" style="document"/>
<input name="storRequest">
<soap12:body use="literal"/>
</input>
<output name="storResponse">
<soap12:body use="literal"/>
</output>
</operation>
</binding>
...
</definitions>
|
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
...
<types>
<schema targetNamespace="http://mediStor.org/types/"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
<complexType name="xRayType">
<sequence>
<element name="patientName" type="xsd:string" />
<element name="patientNumber" type="xsd:int" />
<element name="imageData" type="xsd:base64Binary"
xmime:expectedContentTypes="application/octet-stream"/>
</sequence>
</complexType>
<element name="xRay" type="xsd1:xRayType" />
</schema>
</types>
...
|
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@XmlType
public class XRayType {
protected String patientName;
protected int patientNumber;
@XmlMimeType("application/octet-stream")
protected DataHandler imageData;
...
}
|
...
- Get access to the
Endpoint
object for your published service.
The easiest way to get theEndpoint
object is when you publish the endpoint. Get the SOAP binding from the
Endpoint
using itsgetBinding()
method as shown below.Code Block java java title Getting the SOAP Binding from an Endpoint // Endpoint ep is declared previously SOAPBinding binding = (SOAPBinding)ep.getBinding();
You must cast the returned binding object to a
SOAPBinding
object in order to access the MTOM property.Set the bindings MTOM enabled property to true using the binding's setMTOMEnabled() method as shown below.
Code Block java java title Setting a Service Provider's MTOM Enabled Property binding.setMTOMEnabled(true);
...
- Cast the client's proxy to a
BindingProvider
object. Get the SOAP binding from the
BindingProvider
using itsgetBinding()
method as shown below.Code Block java java title Getting a SOAP Binding from a BindingProvider // BindingProvider bp declared previously SOAPBinding binding = (SOAPBinding)bp.getBinding();
Set the bindings MTOM enabled property to
true
using the binding'ssetMTOMEnabled()
method as shown below.Code Block java java title Setting a Consumer's MTOM Enabled Property binding.setMTOMEnabled(true);
...
If you publish your service using XML, such as when deploying into a container, you can enable your endpoint's MTOM support in the endpoint's configuration file.
Anchor | ||||
---|---|---|---|---|
|
...
Procedure
The MTOM property is set inside the jaxws:endpoint
element for your endpoint. To enable MTOM do the following:
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
<jaxws:endpoint id="xRayStorage"
implementor="demo.spring.xRayStorImpl"
address="http://localhost/xRayStorage">
<jaxws:properties>
<entry key="mtom-enabled" value="true"/>
</jaxws:properties>
</jaxws:endpoint>
</beans>
|