You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kiran Sriram <ki...@hotmail.com> on 2008/02/07 00:13:49 UTC

Exception in Axis2 Client when reading Attachment

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....@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/

Re: Exception in Axis2 Client when reading Attachment

Posted by Christoph Ludwig <lu...@fh-worms.de>.
Hi,

On Wed, Feb 06, 2008 at 06:13:49PM -0500, Kiran Sriram wrote:
> 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");

could this be the same issue as the one I reported in #3488
<URL:https://issues.apache.org/jira/browse/AXIS2-3488>? There ar no
attachments involved in my testcase, but we also get an exception due to an
attempted read on a closed stream.

Regards

Christoph

-- 
FH Worms - University of Applied Sciences
Fachbereich Informatik / Telekommunikation
Erenburgerstr. 19, 67549 Worms, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org