You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2014/01/17 20:24:22 UTC

[jira] [Resolved] (CXF-5496) INBOUND_MESSAGE_ATTACHMENTS after soapMessage.writeTo(outputStream)

     [ https://issues.apache.org/jira/browse/CXF-5496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-5496.
------------------------------

       Resolution: Won't Fix
    Fix Version/s: Invalid
         Assignee: Daniel Kulp

This is working as designed.   CXF is designed to stream as much stuff as possible and not pull things off the stream and cache them someplace locally unless specifically required or requested.   

In this case, the writeTo is consuming the data from the stream as it writes the attachments out.   The SAAJ+JAX-WS specs mandates that the writeTo does that within the SOAPHandler.   

If you need this changed, you can add an interceptor modeled off of:
http://svn.apache.org/repos/asf/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java

that would cache the attachments and lock them down, however it's not something we'd do by default due to the performance impact that would cause in the normal cases where that isn't needed.

> INBOUND_MESSAGE_ATTACHMENTS after soapMessage.writeTo(outputStream)
> -------------------------------------------------------------------
>
>                 Key: CXF-5496
>                 URL: https://issues.apache.org/jira/browse/CXF-5496
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.7
>            Reporter: Frank Cornelis
>            Assignee: Daniel Kulp
>             Fix For: Invalid
>
>
> In a client I receive SOAP attachments.
> Retrieving them within a SOAPHandler via
> {code}
> context.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)
> {code}
> works, but if I first do (for logging purposes)
> {code}
> SOAPMessage soapMessage = context.getMessage();
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> soapMessage.writeTo(outputStream);
> {code}
> and afterwards try to retrieve the SOAP attachments via:
> {code}
> context.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)
> {code}
> the DataHandler gives me an empty byte array.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)