Yea, definitely use the ByteArrayDataSource like Glen's example does. If you don't provide a specific DataSource, the activation framework tries to find something that can handle it. Since it's already a byte[], it's best to just leave it as a byte[] like that and not convert it to anything.
That said, the CXF ImageDataContentHandler could be updated to handle this better. Dan On Thursday, August 02, 2012 03:06:52 PM Glen Mazza wrote: > Perhaps the source code I have for returning PDFs : > http://www.jroller.com/gmazza/entry/using_mtom_and_apache_fop might work > for you with TIFFs. (Look at the very bottom of that article for the > simplest way to send a TIFF and see if that works.) > > Is there anything in the Wireshark output > (http://www.jroller.com/gmazza/entry/soap_calls_over_wireshark) you can > see that might be causing the CXF hiccup? You may wish to deploy on > Tomcat, possibly also using Metro (1st link above works with either CXF > or Metro) to try to ascertain whether the problem is with CXF, Weblogic, > the TIFFs you're producing, or Java itself. > > HTH, > Glen > > On 08/01/2012 05:38 PM, jaybytez wrote: > > We are using CXF 2.4.5, WLS 11, Spring 3.0.5, JAXB 2, etc. > > > > Our Message Model has fields that are defined as : > > > > @XmlElement(name = "Data", namespace = "##default") > > @XmlMimeType("application/octet-stream") > > private DataHandler data; > > > > We create the DataHandler as such: > > > > import org.apache.commons.codec.binary.Base64; > > > > DataHandler dataHandler = new > > DataHandler(Base64.decodeBase64(docContentString), > > docAttribute.getValue()); //Content String and MimeType > > > > When we send a web service response with a DataHandler that holds the > > stream for a pdf, we don't have a problem sending this response across > > the wire (and the serialization of this). > > > > But when we send a TIFF stream, we get the following error. > > > > Is there something simple we could be missing that would cause this > > difference between the two file types? > > > > 2012-07-11 09:32:11,156 [[ACTIVE] ExecuteThread: '39' for queue: > > 'weblogic.kernel.Default (self-tuning)'] DEBUG > > com.foo.service.dms.DocMgmtBusinessServiceImpl - getDocument: Returning > > documentResponse for doc ID: 817964 > > 2012-07-11 09:32:11,296 [[ACTIVE] ExecuteThread: '39' for queue: > > 'weblogic.kernel.Default (self-tuning)'] WARN > > org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for > > {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn > > dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has > > thrown exception, unwinding now > > org.apache.cxf.interceptor.Fault: Could not write attachments. > > > > at > > > > org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingI > > nterceptor.handleMessage(AttachmentOutInterceptor.java:98) > > ~[cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > > hain.java:263) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Outgoi > > ngChainInterceptor.java:77) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > > hain.java:263) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati > > onObserver.java:121) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTT > > PDestination.java:207) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser > > vletController.java:209) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl > > ler.java:191) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpring > > Servlet.java:114) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstr > > actHTTPServlet.java:185) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTP > > Servlet.java:108) [cxf-full.jar:2.4.5] > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) > > > > [javax.servlet_1.0.0.0_2-5.jar:2.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT > > PServlet.java:164) [cxf-full.jar:2.4.5] > > > > at > > > > weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St > > ubSecurityHelper.java:227) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH > > elper.java:125) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3 > > 00) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1 > > 83) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.w > > rapRun(WebAppServletContext.java:3717) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r > > un(WebAppServletContext.java:3681) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu > > bject.java:321) > > [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1] > > > > at > > > > weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120 > > ) > > [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ > > letContext.java:2277) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont > > ext.java:2183) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java > > :1454) [weblogic.jar:10.3.5.0] > > > > at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) > > > > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0] > > > > at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) > > > > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0] > > Caused by: java.io.IOException: Attachment type not spported class [B > > > > at > > > > org.apache.cxf.attachment.ImageDataContentHandler.writeTo(ImageDataConte > > ntHandler.java:85) ~[cxf-full.jar:2.4.5] > > > > at > > > > javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869) > > ~[na:1.6.0_29] > > > > at javax.activation.DataHandler.writeTo(DataHandler.java:302) > > > > ~[na:1.6.0_29] > > > > at > > > > org.apache.cxf.attachment.AttachmentSerializer.writeAttachments(Attachme > > ntSerializer.java:234) ~[cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.interceptor.AttachmentOutInterceptor$AttachmentOutEndingI > > nterceptor.handleMessage(AttachmentOutInterceptor.java:96) > > ~[cxf-full.jar:2.4.5] > > > > ... 25 common frames omitted > > > > 2012-07-11 09:32:11,302 [[ACTIVE] ExecuteThread: '39' for queue: > > 'weblogic.kernel.Default (self-tuning)'] WARN > > org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for > > {http://healthnet.com/hnfs/services/dms}DocMgmtBusinessServiceEn > > dpointService#{http://healthnet.com/hnfs/services/dms}getDocument has > > thrown exception, unwinding now > > java.util.EmptyStackException: null > > > > at weblogic.utils.collections.Stack.pop(Stack.java:82) > > > > ~[com.bea.core.utils_1.9.0.1.jar:1.9.0.1] > > > > at > > > > weblogic.xml.stax.XMLWriterBase.writeEndElement(XMLWriterBase.java:491) > > ~[com.bea.core.weblogic.stax_1.9.0.0.jar:1.9.0.0] > > > > at > > > > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEnding > > Interceptor.handleMessage(SoapOutInterceptor.java:279) > > ~[cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEnding > > Interceptor.handleMessage(SoapOutInterceptor.java:270) > > ~[cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > > hain.java:263) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage > > (AbstractFaultChainInitiatorObserver.java:105) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > > hain.java:323) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Outgoi > > ngChainInterceptor.java:77) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > > hain.java:263) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati > > onObserver.java:121) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTT > > PDestination.java:207) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser > > vletController.java:209) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl > > ler.java:191) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpring > > Servlet.java:114) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstr > > actHTTPServlet.java:185) [cxf-full.jar:2.4.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTP > > Servlet.java:108) [cxf-full.jar:2.4.5] > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) > > > > [javax.servlet_1.0.0.0_2-5.jar:2.5] > > > > at > > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT > > PServlet.java:164) [cxf-full.jar:2.4.5] > > > > at > > > > weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(St > > ubSecurityHelper.java:227) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH > > elper.java:125) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:3 > > 00) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:1 > > 83) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.w > > rapRun(WebAppServletContext.java:3717) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r > > un(WebAppServletContext.java:3681) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu > > bject.java:321) > > [com.bea.core.weblogic.security.identity_1.1.2.1.jar:1.1.2.1] > > > > at > > > > weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120 > > ) > > [com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar:6.1.0.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ > > letContext.java:2277) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont > > ext.java:2183) [weblogic.jar:10.3.5.0] > > > > at > > > > weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java > > :1454) [weblogic.jar:10.3.5.0] > > > > at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) > > > > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0] > > > > at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) > > > > [com.bea.core.weblogic.workmanager_1.10.0.0.jar:1.10.0.0] > > > > > > > > > > -- > > View this message in context: > > http://cxf.547215.n5.nabble.com/MTOM-failing-when-attaching-a-tiff-but- > > works-with-pdf-tp5711907.html Sent from the cxf-user mailing list > > archive at Nabble.com. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
