What does MTOM/XOP do:
Binary data is encoded and transmitted as an attachment which is still referable and reacheable from within the message as part of the XML infoset.
Enable client side MTOM feature:
MtomSample port = new MtomService().getMtomPort(new MTOMFeature());
Enable server side MTOM:
Annotate server implementation class
import javax.xml.ws.soap.MTOM; @MTOM @WebService (endpointInterface = "mtom.server.MtomSample") public class MtomSampleImpl implements MtomSample { ...
Annotate the data element with xmime:expectedContentTypes
<wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/mtom/data" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified"> <!-- annotating the 'data' element below with xmime:expectedContentTypes will result in to this paramter mapped to java.awt.Image --> <element name="photo" type="base64Binary" xmime:expectedContentTypes="image/jpeg"/> <element name="data" type="base64Binary" xmime:expectedContentTypes="application/octet-stream"/> <element name="uploadResponse" type="string"/> <element name="size" type="int"/> </schema> </wsdl:types>