Hi,

I am trying to send the request XML with the binary within an MTOM
attachment. However, the code below sends the binary inline with the rest of
the xml request. My understanding from the Axis2 examples is that by
enabling MTOM, the binary will be sent as a referenced attachment. Is there
something that I'm not doing?

Thanks,
Nathan

ServiceClient service = *new* ServiceClient();

Options options = *new* Options();

options.setTo(*new* EndpointReference(*URL*));

options.setAction("urn:update");

options.setProperty(Constants.Configuration.*ENABLE_MTOM*, Constants.*
VALUE_TRUE*);

service.setOptions(options);

*try* {

OMFactory fac = OMAbstractFactory.*getOMFactory*();

OMNamespace omNs = fac.createOMNamespace("catalog", "");

OMElement up = fac.createOMElement("in0", omNs);

FileDataSource fds = *new* FileDataSource("file.xml");

DataHandler dataHandler = *new* DataHandler(fds);

OMText textData = fac.createOMText(dataHandler, *true*);

textData.setOptimize(*true*);

up.addChild(textData);

//OMElement res = service.sendReceive(up);

//service.fireAndForget(up);

service.sendRobust(up);

}

*catch*(Exception error) {

error.printStackTrace();

}

Reply via email to