Hi all,
I am having some trouble sending attachments with axis2 messages. Until now I have been sending a large xml string as a parameter of a web service call. I recently applied security to this and I am getting a lot of errors when the string parameter goes beyond a certain size. What I am exploring as a work around is sending the xml file as an attachment using MTOM. From some v quick research i think this is the best approach when security is involved. My problem is on the parsing of this message. I am getting a "ContentID is null" message. Is this because I have not specified the MIME type in the Client? My client code looks like...

OMElement value = fac.createOMElement("Text", omNs);
DataHandler dh = new DataHandler(new ByteArrayDataSource(s.getBytes()));
OMText text = fac.createText(dh, true);
value.addChild(text);
where s is a String.

The server code to parse this looks like...
OMElement binaryElement = element.getFirstElement();
OMText binaryNode = (OMText) binaryElement.getFirstOMChild();
DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();

Anybody see any problems in this?
Regards,
Brian.

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.

Reply via email to