cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to send attachment in response to a web service call
Date Thu, 10 Jun 2010 14:23:41 GMT

My suggestion would be to update to CXF 2.2.9.   There were a lot of fixes 
that were put around various streaming attachment handling that may have 
likely fixed this already. 

I don't know if the 2.1.10 release (last on 2.1.x) would have all the 
attachment fixes or not.

Dan




On Thursday 10 June 2010 5:53:58 am Naresh Tallapelli wrote:
> HI All,
> 
>  I am using CXF-2.1.2 version. I have a requirement to send an attachment
> from web services server to the client as part of one  web service call
> response. I have created the response element as following in wsdl file,
> *
> <xsd:element name="fileStreamResponse" type="xsd:base64Binary"
> 
> xmime:expectedContentTypes="application/octet-stream" maxOccurs="1"
>                             minOccurs="1">*
> 
> When web service operation is called i am creating "FileDataHandler" for
> file and returning the handler as part of response. Server is able to send
> the attachment to the client. I can see the following log message on web
> services server side.
> 
> *<soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns5:test
> MtomResponseResponse><fileStreamResponse><xop:Include
> xmlns:xop="http://www.w3.org/2004/08/xop/include"
> href="cid:e47836d1-3362-48ce-bbac-f1bd033ea2ef@http%3A%2F%2Fcxf.apache.org
> %2F"/></fileStreamResponse></ns5:testMtomResponseResponse></soap:Body></soa
> p:Envelope> ------=_Part_0_8371737.1276162616240
> Content-Type: text/plain
> Content-Transfer-Encoding: binary
> Content-ID: <e47836d1-3362-48ce-bbac-f1bd033ea2ef@http%3A%2F%
> 2Fcxf.apache.org%2F>
> 
> This is the response created intially on the server.*
> 
> But the client is not able to receive the attachment. In
> "AttachmentInInterceptor" if the message type is multipart, then we cxf
> code is loading the attachments lazily. That's the reason why the client
> is not able to get the response. Web services client is throwing the
> following exception,
> 
> *    java.io.EOFException: Unexpected end of ZLIB input stream
>     at
> org.apache.cxf.attachment.AttachmentDeserializer.readNext(AttachmentDeseria
> lizer.java:187) at
> org.apache.cxf.attachment.LazyAttachmentCollection$1.hasNext(LazyAttachment
> Collection.java:73) at
> org.apache.cxf.attachment.LazyDataSource.load(LazyDataSource.java:49) at
> org.apache.cxf.attachment.LazyDataSource.getContentType(LazyDataSource.java
> :59) at javax.activation.DataHandler.getContentType(Unknown Source) at
> javax.activation.DataHandler.getBaseType(Unknown Source)
>     at javax.activation.DataHandler.getDataContentHandler(Unknown Source)
>     at javax.activation.DataHandler.getContent(Unknown Source)*
> 
> Please help me to resolve this issue.Any help would be much appreciated.
> 
> Thank you,
> Naresh.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message