You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2009/06/01 20:43:05 UTC
Re: Attachments
There is definitely something wrong with the INBOUND_MESSAGE_ATTACHMENTS keys.
Looking at the code:
if (MessageContext.INBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
if (isOutbound()) {
ret = reqMessage.get(key);
}
ret = createAttachments(getWrappedMessage(),
MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
}
The ret set in the isOutbound is always overwritten so that's irrelevant.
getWrappedMessage also always re-creates things.
You PROBABLY can get it to work by getting the
"org.apache.cxf.message.Message.ATTACHMENTS" object which is most likely a
Collection<Attachment>. If you need that as a standard map:
Map<String, DataHandler> dataHandlers =
AttachmentUtil.getDHMap(attachments);
Dan
On Sun May 31 2009 7:26:30 am zbale wrote:
> Anyone please?
>
> Thanks!
>
> zbale wrote:
> > Hi,
> > When using CXF 2.1.2 and this code to get attachments:
> > BindingProvider bp = (BindingProvider) client;
> > java.util.Map<String, Object> responseContext =
> > bp.getResponseContext();
> > return (Map)
> > responseContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
> >
> > Attachment was returned successfully.
> >
> > When moving to CXF 2.1.5 Attachments were not received with the exact
> > same code above. Looking on responseContext Map I now see that instead of
> > key javax.xml.ws.binding.attachments.inbound (this is the value of
> > MessageContext.INBOUND_MESSAGE_ATTACHMENTS) there is a key
> > "org.apache.cxf.message.Message.ATTACHMENTS".
> > How should I get the attachment please? Am I doing something wrong?
> > Anyone else having problems with attachments on 2.1.5?
> >
> > Thanks,
> > Zbal Jr.
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Attachments
Posted by Daniel Kulp <dk...@apache.org>.
FYI:
this is now fixed on trunk and 2.1.x so the latest snapshots should work fine.
Dan
On Mon June 1 2009 2:43:05 pm Daniel Kulp wrote:
> There is definitely something wrong with the INBOUND_MESSAGE_ATTACHMENTS
> keys. Looking at the code:
>
> if (MessageContext.INBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
> if (isOutbound()) {
> ret = reqMessage.get(key);
> }
> ret = createAttachments(getWrappedMessage(),
> MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
> }
>
> The ret set in the isOutbound is always overwritten so that's irrelevant.
> getWrappedMessage also always re-creates things.
>
>
> You PROBABLY can get it to work by getting the
> "org.apache.cxf.message.Message.ATTACHMENTS" object which is most likely a
> Collection<Attachment>. If you need that as a standard map:
>
> Map<String, DataHandler> dataHandlers =
> AttachmentUtil.getDHMap(attachments);
>
> Dan
>
> On Sun May 31 2009 7:26:30 am zbale wrote:
> > Anyone please?
> >
> > Thanks!
> >
> > zbale wrote:
> > > Hi,
> > > When using CXF 2.1.2 and this code to get attachments:
> > > BindingProvider bp = (BindingProvider) client;
> > > java.util.Map<String, Object> responseContext =
> > > bp.getResponseContext();
> > > return (Map)
> > > responseContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
> > >
> > > Attachment was returned successfully.
> > >
> > > When moving to CXF 2.1.5 Attachments were not received with the exact
> > > same code above. Looking on responseContext Map I now see that instead
> > > of key javax.xml.ws.binding.attachments.inbound (this is the value of
> > > MessageContext.INBOUND_MESSAGE_ATTACHMENTS) there is a key
> > > "org.apache.cxf.message.Message.ATTACHMENTS".
> > > How should I get the attachment please? Am I doing something wrong?
> > > Anyone else having problems with attachments on 2.1.5?
> > >
> > > Thanks,
> > > Zbal Jr.
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog