Hi,

I have been looking at wiriting a client using AXIOM for sending
binary attachments. The code is shown below,

    public void testExchange() throws Exception {

        DataHandler dataHandler = new DataHandler(new
FileDataSource("Picture.jpg"));

        OMFactory fac = OMAbstractFactory.getOMFactory();

        OMElement request = fac.createOMElement("data", null);

        OMText binaryData = fac.createOMText(dataHandler, true);
        binaryData.setOptimize(false);

        request.addChild(binaryData);

        OMElement method = fac.createOMElement("exchange", null);
        method.addChild(request);

        Options options = new Options();
        options.setTo(new
EndpointReference("http://localhost:8900/axis2/exchange";));
        options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);

        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        sender.sendReceive(method);

    }

Unfortunately, the message is being sent to the server inlined without
any mime parts. I have tried SWA instead of MTOM, but the same result.
Any pointers would be highly appreciated. The message trace for
request is shown below,

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
  <soapenv:Body>
    <exchange>
      <data>/9j/4RBZRXhpZgA.....38z/2Q==</data>
    </exchange>
  </soapenv:Body>
</soapenv:Envelope>

Kind regards
Meeraj

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to