axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Sriram <kiran.sri...@hotmail.com>
Subject Exception in Axis2 Client when reading Attachment
Date Wed, 06 Feb 2008 23:13:49 GMT
Hello, I am getting this exception when trying to read an attachment in Axis2 client. 
org.apache.axiom.om.OMException: javax.mail.MessagingException: Error in input stream;
nested exception is:
java.io.IOException: Attempted read on closed stream.
at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
at org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
at PCMClient.main(PCMClient.java:79)Caused by: javax.mail.MessagingException: Error in input
stream; This is how i am reading attachment on client side, client side stubs are generated
using Axis2 WSDL2Java utility. 
stub2.ContentExportAsAttachment(false, "nolock", "binary");
MessageContext messageContext = stub2._getServiceClient().getLastOperationContext().getMessageContext("In");



System.out.println("getting attachments from MessageContext...");


//I have set attachment id as "FirstAttachment" on service impl.
DataHandler dh = messageContext.getAttachment("FirstAttachment");
byte[] responseBytes = getBytesFromDataHandler(dh); The service is implemented in Axis2 using
Swa. I see the attachment getting transferred in the response on TCPMon.Here is the response
message from TCPMon.************************************************* HTTP/1.1 200 OKServer:
Apache-Coyote/1.1Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_55BD50995DFEE5C7841202338408381;
type="text/xml"; start="0.urn:uuid:55BD50995DFEE5C7841202338408382@apache.org"Transfer-Encoding:
chunkedDate: Wed, 06 Feb 2008 22:53:27 GMT1c1--MIMEBoundaryurn_uuid_55BD50995DFEE5C7841202338408381Content-Type:
text/xml; charset=UTF-8Content-Transfer-Encoding: 8bitContent-ID: <0.urn:uuid:55BD50995DFEE5C7841202338408382@apache.org><?xml
version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:ContentExportAsAttachmentResponse
xmlns:ns1="http://www.example.org/PCMCommand/" /></soapenv:Body></soapenv:Envelope>38--MIMEBoundaryurn_uuid_55BD50995DFEE5C78412023384083812--0****************************************************
Any help is greatly appreciated.  Thank you,Kiran
_________________________________________________________________
Shed those extra pounds with MSN and The Biggest Loser!
http://biggestloser.msn.com/
Mime
View raw message