You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Penmatsa, Vinay" <vi...@sap.com> on 2013/05/14 18:48:38 UTC

JAX-RS XmlAttachmentRef

Hi

Using CXF 2.6.1,

	@XmlAttachmentRef
	private DataHandler email;

produces the following error:
Caused by: java.lang.UnsupportedOperationException
	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
	... 42 more


If I do this,

 @XmlElement
 private DataHandler email; 

it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method. 
Somewhat confused what's happening.

Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?

Thanks,
Vinay


Re: JAX-RS XmlAttachmentRef

Posted by Sergey Beryozkin <sb...@gmail.com>.
Fixed - thanks for reporting the issue
Sergey
On 15/05/13 17:32, Penmatsa, Vinay wrote:
> Ok, that seems to be a non-issue. Something I did wrong. Pls ignore.
>
> -----Original Message-----
> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
> Sent: Wednesday, May 15, 2013 12:05 PM
> To: users@cxf.apache.org
> Subject: RE: JAX-RS XmlAttachmentRef
>
> Just one more thing...
> There seems to be a mismatch with the content id representation
> The org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addSwaRefAttachment() doesn't seem to add "cid:" prefix while marshalling.
> And during un-marshalling request, the org.apache.cxf.attachment.AttachmentUtil.getAttachmentDataSource() seems to look for this prefix while resolving related, mixed type attachments.
>
>
> -Vinay
>
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Wednesday, May 15, 2013 11:45 AM
> To: users@cxf.apache.org
> Subject: Re: JAX-RS XmlAttachmentRef
>
> Hi - yes, I'll update once it's done
>
> Cheers. Sergey
> On 15/05/13 14:51, Penmatsa, Vinay wrote:
>> Hi Sergey,
>> Thanks. Would you fix this in 2.6.x?
>>
>> -Vinay
>>
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
>> Sent: Tuesday, May 14, 2013 3:58 PM
>> To: users@cxf.apache.org
>> Subject: Re: JAX-RS XmlAttachmentRef
>>
>> Hi Vinay
>>
>> Thanks for making it work, comments below
>>
>> On 14/05/13 20:24, Penmatsa, Vinay wrote:
>>> Sorry, I keep answering my own mail.
>>>
>>> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>>>
>>> The response looks like:
>>> =============================
>>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>>> Content-Type: application/xml
>>> Content-Transfer-Encoding: binary
>>> Content-ID:<ma>
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>>>
>>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>>> Content-Type: application/octet-stream
>>> Content-Transfer-Encoding: binary
>>> Content-ID:<12...@apache.org>
>>> .....
>>> .....
>>> ============================
>>>
>>>
>>> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
>>> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>>>
>> I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP
>> attachments supported with XOP being the possibility outside of the WS
>> scope.
>> I left out addSwaRefAttachment as I did not know it would be required to
>> get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM
>> - I guess I'll copy the relevant code from the original
>> as well.
>>
>> Re List<DataHandler>, is it in context of XOP as well ? If yes then I
>> guess it just should work, if it is non XOP multipart payloads, then it
>> should work, we have a pretty extensive support for HTTP multiparts, see
>>
>> http://cxf.apache.org/docs/jax-rs-multiparts.html
>>
>> Thanks
>> Sergey
>>
>>
>>
>>
>>> -Vinay
>>>
>>>
>>> -----Original Message-----
>>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>>> Sent: Tuesday, May 14, 2013 1:46 PM
>>> To: users@cxf.apache.org
>>> Subject: RE: JAX-RS XmlAttachmentRef
>>>
>>> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
>>> Is swaref with @XMLAttachmentRef not supported?
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>>> Sent: Tuesday, May 14, 2013 12:49 PM
>>> To: users@cxf.apache.org
>>> Subject: JAX-RS XmlAttachmentRef
>>>
>>> Hi
>>>
>>> Using CXF 2.6.1,
>>>
>>> 	@XmlAttachmentRef
>>> 	private DataHandler email;
>>>
>>> produces the following error:
>>> Caused by: java.lang.UnsupportedOperationException
>>> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
>>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
>>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
>>> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
>>> 	... 42 more
>>>
>>>
>>> If I do this,
>>>
>>>     @XmlElement
>>>     private DataHandler email;
>>>
>>> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
>>> Somewhat confused what's happening.
>>>
>>> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>>>
>>> Thanks,
>>> Vinay
>>>
>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

RE: JAX-RS XmlAttachmentRef

Posted by "Penmatsa, Vinay" <vi...@sap.com>.
Ok, that seems to be a non-issue. Something I did wrong. Pls ignore.

-----Original Message-----
From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com] 
Sent: Wednesday, May 15, 2013 12:05 PM
To: users@cxf.apache.org
Subject: RE: JAX-RS XmlAttachmentRef

Just one more thing...
There seems to be a mismatch with the content id representation 
The org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addSwaRefAttachment() doesn't seem to add "cid:" prefix while marshalling.
And during un-marshalling request, the org.apache.cxf.attachment.AttachmentUtil.getAttachmentDataSource() seems to look for this prefix while resolving related, mixed type attachments.


-Vinay


-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Wednesday, May 15, 2013 11:45 AM
To: users@cxf.apache.org
Subject: Re: JAX-RS XmlAttachmentRef

Hi - yes, I'll update once it's done

Cheers. Sergey
On 15/05/13 14:51, Penmatsa, Vinay wrote:
> Hi Sergey,
> Thanks. Would you fix this in 2.6.x?
>
> -Vinay
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Tuesday, May 14, 2013 3:58 PM
> To: users@cxf.apache.org
> Subject: Re: JAX-RS XmlAttachmentRef
>
> Hi Vinay
>
> Thanks for making it work, comments below
>
> On 14/05/13 20:24, Penmatsa, Vinay wrote:
>> Sorry, I keep answering my own mail.
>>
>> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>>
>> The response looks like:
>> =============================
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/xml
>> Content-Transfer-Encoding: binary
>> Content-ID:<ma>
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>>
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>> Content-ID:<12...@apache.org>
>> .....
>> .....
>> ============================
>>
>>
>> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
>> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>>
> I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP
> attachments supported with XOP being the possibility outside of the WS
> scope.
> I left out addSwaRefAttachment as I did not know it would be required to
> get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM
> - I guess I'll copy the relevant code from the original
> as well.
>
> Re List<DataHandler>, is it in context of XOP as well ? If yes then I
> guess it just should work, if it is non XOP multipart payloads, then it
> should work, we have a pretty extensive support for HTTP multiparts, see
>
> http://cxf.apache.org/docs/jax-rs-multiparts.html
>
> Thanks
> Sergey
>
>
>
>
>> -Vinay
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 1:46 PM
>> To: users@cxf.apache.org
>> Subject: RE: JAX-RS XmlAttachmentRef
>>
>> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
>> Is swaref with @XMLAttachmentRef not supported?
>>
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 12:49 PM
>> To: users@cxf.apache.org
>> Subject: JAX-RS XmlAttachmentRef
>>
>> Hi
>>
>> Using CXF 2.6.1,
>>
>> 	@XmlAttachmentRef
>> 	private DataHandler email;
>>
>> produces the following error:
>> Caused by: java.lang.UnsupportedOperationException
>> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
>> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
>> 	... 42 more
>>
>>
>> If I do this,
>>
>>    @XmlElement
>>    private DataHandler email;
>>
>> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
>> Somewhat confused what's happening.
>>
>> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>>
>> Thanks,
>> Vinay
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

RE: JAX-RS XmlAttachmentRef

Posted by "Penmatsa, Vinay" <vi...@sap.com>.
Just one more thing...
There seems to be a mismatch with the content id representation 
The org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addSwaRefAttachment() doesn't seem to add "cid:" prefix while marshalling.
And during un-marshalling request, the org.apache.cxf.attachment.AttachmentUtil.getAttachmentDataSource() seems to look for this prefix while resolving related, mixed type attachments.


-Vinay


-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Wednesday, May 15, 2013 11:45 AM
To: users@cxf.apache.org
Subject: Re: JAX-RS XmlAttachmentRef

Hi - yes, I'll update once it's done

Cheers. Sergey
On 15/05/13 14:51, Penmatsa, Vinay wrote:
> Hi Sergey,
> Thanks. Would you fix this in 2.6.x?
>
> -Vinay
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Tuesday, May 14, 2013 3:58 PM
> To: users@cxf.apache.org
> Subject: Re: JAX-RS XmlAttachmentRef
>
> Hi Vinay
>
> Thanks for making it work, comments below
>
> On 14/05/13 20:24, Penmatsa, Vinay wrote:
>> Sorry, I keep answering my own mail.
>>
>> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>>
>> The response looks like:
>> =============================
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/xml
>> Content-Transfer-Encoding: binary
>> Content-ID:<ma>
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>>
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>> Content-ID:<12...@apache.org>
>> .....
>> .....
>> ============================
>>
>>
>> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
>> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>>
> I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP
> attachments supported with XOP being the possibility outside of the WS
> scope.
> I left out addSwaRefAttachment as I did not know it would be required to
> get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM
> - I guess I'll copy the relevant code from the original
> as well.
>
> Re List<DataHandler>, is it in context of XOP as well ? If yes then I
> guess it just should work, if it is non XOP multipart payloads, then it
> should work, we have a pretty extensive support for HTTP multiparts, see
>
> http://cxf.apache.org/docs/jax-rs-multiparts.html
>
> Thanks
> Sergey
>
>
>
>
>> -Vinay
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 1:46 PM
>> To: users@cxf.apache.org
>> Subject: RE: JAX-RS XmlAttachmentRef
>>
>> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
>> Is swaref with @XMLAttachmentRef not supported?
>>
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 12:49 PM
>> To: users@cxf.apache.org
>> Subject: JAX-RS XmlAttachmentRef
>>
>> Hi
>>
>> Using CXF 2.6.1,
>>
>> 	@XmlAttachmentRef
>> 	private DataHandler email;
>>
>> produces the following error:
>> Caused by: java.lang.UnsupportedOperationException
>> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
>> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
>> 	... 42 more
>>
>>
>> If I do this,
>>
>>    @XmlElement
>>    private DataHandler email;
>>
>> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
>> Somewhat confused what's happening.
>>
>> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>>
>> Thanks,
>> Vinay
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: JAX-RS XmlAttachmentRef

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi - yes, I'll update once it's done

Cheers. Sergey
On 15/05/13 14:51, Penmatsa, Vinay wrote:
> Hi Sergey,
> Thanks. Would you fix this in 2.6.x?
>
> -Vinay
>
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> Sent: Tuesday, May 14, 2013 3:58 PM
> To: users@cxf.apache.org
> Subject: Re: JAX-RS XmlAttachmentRef
>
> Hi Vinay
>
> Thanks for making it work, comments below
>
> On 14/05/13 20:24, Penmatsa, Vinay wrote:
>> Sorry, I keep answering my own mail.
>>
>> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>>
>> The response looks like:
>> =============================
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/xml
>> Content-Transfer-Encoding: binary
>> Content-ID:<ma>
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>>
>> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>> Content-ID:<12...@apache.org>
>> .....
>> .....
>> ============================
>>
>>
>> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
>> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>>
> I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP
> attachments supported with XOP being the possibility outside of the WS
> scope.
> I left out addSwaRefAttachment as I did not know it would be required to
> get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM
> - I guess I'll copy the relevant code from the original
> as well.
>
> Re List<DataHandler>, is it in context of XOP as well ? If yes then I
> guess it just should work, if it is non XOP multipart payloads, then it
> should work, we have a pretty extensive support for HTTP multiparts, see
>
> http://cxf.apache.org/docs/jax-rs-multiparts.html
>
> Thanks
> Sergey
>
>
>
>
>> -Vinay
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 1:46 PM
>> To: users@cxf.apache.org
>> Subject: RE: JAX-RS XmlAttachmentRef
>>
>> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
>> Is swaref with @XMLAttachmentRef not supported?
>>
>>
>>
>> -----Original Message-----
>> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
>> Sent: Tuesday, May 14, 2013 12:49 PM
>> To: users@cxf.apache.org
>> Subject: JAX-RS XmlAttachmentRef
>>
>> Hi
>>
>> Using CXF 2.6.1,
>>
>> 	@XmlAttachmentRef
>> 	private DataHandler email;
>>
>> produces the following error:
>> Caused by: java.lang.UnsupportedOperationException
>> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
>> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
>> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
>> 	... 42 more
>>
>>
>> If I do this,
>>
>>    @XmlElement
>>    private DataHandler email;
>>
>> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
>> Somewhat confused what's happening.
>>
>> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>>
>> Thanks,
>> Vinay
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

RE: JAX-RS XmlAttachmentRef

Posted by "Penmatsa, Vinay" <vi...@sap.com>.
Hi Sergey,
Thanks. Would you fix this in 2.6.x?

-Vinay

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Tuesday, May 14, 2013 3:58 PM
To: users@cxf.apache.org
Subject: Re: JAX-RS XmlAttachmentRef

Hi Vinay

Thanks for making it work, comments below

On 14/05/13 20:24, Penmatsa, Vinay wrote:
> Sorry, I keep answering my own mail.
>
> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>
> The response looks like:
> =============================
> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
> Content-Type: application/xml
> Content-Transfer-Encoding: binary
> Content-ID:<ma>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>
> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID:<12...@apache.org>
> .....
> .....
> ============================
>
>
> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>
I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP 
attachments supported with XOP being the possibility outside of the WS 
scope.
I left out addSwaRefAttachment as I did not know it would be required to 
get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM 
- I guess I'll copy the relevant code from the original
as well.

Re List<DataHandler>, is it in context of XOP as well ? If yes then I 
guess it just should work, if it is non XOP multipart payloads, then it 
should work, we have a pretty extensive support for HTTP multiparts, see

http://cxf.apache.org/docs/jax-rs-multiparts.html

Thanks
Sergey




> -Vinay
>
>
> -----Original Message-----
> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
> Sent: Tuesday, May 14, 2013 1:46 PM
> To: users@cxf.apache.org
> Subject: RE: JAX-RS XmlAttachmentRef
>
> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
> Is swaref with @XMLAttachmentRef not supported?
>
>
>
> -----Original Message-----
> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
> Sent: Tuesday, May 14, 2013 12:49 PM
> To: users@cxf.apache.org
> Subject: JAX-RS XmlAttachmentRef
>
> Hi
>
> Using CXF 2.6.1,
>
> 	@XmlAttachmentRef
> 	private DataHandler email;
>
> produces the following error:
> Caused by: java.lang.UnsupportedOperationException
> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
> 	... 42 more
>
>
> If I do this,
>
>   @XmlElement
>   private DataHandler email;
>
> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
> Somewhat confused what's happening.
>
> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>
> Thanks,
> Vinay
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: JAX-RS XmlAttachmentRef

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Vinay

Thanks for making it work, comments below

On 14/05/13 20:24, Penmatsa, Vinay wrote:
> Sorry, I keep answering my own mail.
>
> What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.
>
> The response looks like:
> =============================
> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
> Content-Type: application/xml
> Content-Transfer-Encoding: binary
> Content-ID:<ma>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>
>
> --uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID:<12...@apache.org>
> .....
> .....
> ============================
>
>
> Does this seem correct in terms of how swaref should work? (email field in the root attachment)
> What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?
>
I've copied JAXBAttachmentMarshaller from the WS frontend to get XOP 
attachments supported with XOP being the possibility outside of the WS 
scope.
I left out addSwaRefAttachment as I did not know it would be required to 
get XmlAttachmentRef supported, thought it was only needed for SOAP MTOM 
- I guess I'll copy the relevant code from the original
as well.

Re List<DataHandler>, is it in context of XOP as well ? If yes then I 
guess it just should work, if it is non XOP multipart payloads, then it 
should work, we have a pretty extensive support for HTTP multiparts, see

http://cxf.apache.org/docs/jax-rs-multiparts.html

Thanks
Sergey




> -Vinay
>
>
> -----Original Message-----
> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
> Sent: Tuesday, May 14, 2013 1:46 PM
> To: users@cxf.apache.org
> Subject: RE: JAX-RS XmlAttachmentRef
>
> Oh I see...MTOM is enabled for @XMLElement. That's why it works.
> Is swaref with @XMLAttachmentRef not supported?
>
>
>
> -----Original Message-----
> From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com]
> Sent: Tuesday, May 14, 2013 12:49 PM
> To: users@cxf.apache.org
> Subject: JAX-RS XmlAttachmentRef
>
> Hi
>
> Using CXF 2.6.1,
>
> 	@XmlAttachmentRef
> 	private DataHandler email;
>
> produces the following error:
> Caused by: java.lang.UnsupportedOperationException
> 	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
> 	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
> 	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
> 	... 42 more
>
>
> If I do this,
>
>   @XmlElement
>   private DataHandler email;
>
> it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method.
> Somewhat confused what's happening.
>
> Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?
>
> Thanks,
> Vinay
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

RE: JAX-RS XmlAttachmentRef

Posted by "Penmatsa, Vinay" <vi...@sap.com>.
Sorry, I keep answering my own mail.

What I did is override JAXBElementProvider with an implementation of addAttachmentMarshaller() using org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller instead of the default org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller. That seems to solve the problem.

The response looks like:
=============================
--uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
Content-Type: application/xml
Content-Transfer-Encoding: binary
Content-ID: <ma>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Customer><email>128a82b4-24dc-42e5-bd38-ae3a60a188e7@apache.org</email></Customer>

--uuid:f118c4d3-aa61-473c-8c93-0a3101e7e878
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <12...@apache.org>
.....
.....
============================


Does this seem correct in terms of how swaref should work? (email field in the root attachment)
What's the reason org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller does not implement addSwaRefAttachment()?

-Vinay


-----Original Message-----
From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com] 
Sent: Tuesday, May 14, 2013 1:46 PM
To: users@cxf.apache.org
Subject: RE: JAX-RS XmlAttachmentRef

Oh I see...MTOM is enabled for @XMLElement. That's why it works.
Is swaref with @XMLAttachmentRef not supported?



-----Original Message-----
From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com] 
Sent: Tuesday, May 14, 2013 12:49 PM
To: users@cxf.apache.org
Subject: JAX-RS XmlAttachmentRef

Hi

Using CXF 2.6.1,

	@XmlAttachmentRef
	private DataHandler email;

produces the following error:
Caused by: java.lang.UnsupportedOperationException
	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
	... 42 more


If I do this,

 @XmlElement
 private DataHandler email; 

it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method. 
Somewhat confused what's happening.

Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?

Thanks,
Vinay


RE: JAX-RS XmlAttachmentRef

Posted by "Penmatsa, Vinay" <vi...@sap.com>.
Oh I see...MTOM is enabled for @XMLElement. That's why it works.
Is swaref with @XMLAttachmentRef not supported?



-----Original Message-----
From: Penmatsa, Vinay [mailto:vinay.penmatsa@sap.com] 
Sent: Tuesday, May 14, 2013 12:49 PM
To: users@cxf.apache.org
Subject: JAX-RS XmlAttachmentRef

Hi

Using CXF 2.6.1,

	@XmlAttachmentRef
	private DataHandler email;

produces the following error:
Caused by: java.lang.UnsupportedOperationException
	at org.apache.cxf.jaxrs.provider.JAXBAttachmentMarshaller.addSwaRefAttachment(JAXBAttachmentMarshaller.java:73)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:84)
	at com.sun.xml.bind.v2.runtime.SwaRefAdapter.marshal(SwaRefAdapter.java:69)
	at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:76)
	... 42 more


If I do this,

 @XmlElement
 private DataHandler email; 

it seems to work fine. There's a org.apache.cxf.jaxb.attachment. JAXBAttachmentMarshaller that implements the addSwaRefAttachment() method. 
Somewhat confused what's happening.

Also, I need to support a list of attachments like say  List<DataHandler>. Does that work?

Thanks,
Vinay