Hi Brian,
See my comments below...
 
On 3/12/06, Brian Shields <[EMAIL PROTECTED]> wrote:
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.
 
You can also consider using Secure MTOM directly if you r going for encryption... An encrypted payload(cipher value) is a binary content. Normally in the context of web services people encode the payloadcipher value using base64 and send it..Now with MTOM we can directly send the encrypted payload as an binary attachment. Axis2 provides secure MTOM support...

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?
 
AFAIK this does not matter a lot when using data handlers...

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();
 
>>> binaryNode.setOptimize(true);

DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();
 
Do u have MTOM enabled in the client side. MTOM is switched ON by default , but it's worth checking... You can use HttpTracer (aka TCPMON) to see the wire level message. For me it seems ur message still transmits without MTOM optimisation.
 
You can try doing a hack by adding this line in between the 3d and 4th lines in the above given server code...
binaryNode.setOptimize(true);
 
I don't recomend this usage in the long run.. But give it a try.. If it does not give the same error, then it means ur message was not optimized earlier...
 
 
~Thilina


--
"May the SourcE be with u"            
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/                 http://www.bloglines.com/blog/Thilina              

Reply via email to