Hi

On Thu, Jun 30, 2011 at 3:12 AM, Stephen Evanchik <[email protected]> wrote:
> Hello,
>
> On Wed, Jun 29, 2011 at 7:07 PM, dponos <[email protected]> wrote:
>> Hello,
>>
>> I am an Apache CXF newbie, with limited experience developing REST APIs and
>> also limited experience with JAXB and JAX-RS.  I am having an issue using a
>> Class (that was generated using jaxb2:xjc) as a parameter in a REST API
>> method signature.
>
> I have overcome this in the past by registering a JAXBElementProvider:
>
>  Map<String, String> map = new HashMap<String,String>();
>  map.put(MyJaxbElement.class.getName(),
> "{http://example.org/my/ns}XmlElementName";);
>  ....
>  ....
>
>  JAXBElementProvider provider = new JAXBElementProvider();
>  provider.setJaxbElementClassMap(map);
>
> then register the provider with CXF.
>
> Here is a link I found helpful for a JAX RS Client:
>
> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
>
> There may be better ways to do this (I'm not wiring everything
> together using Spring).
>
> I hope that helps (and I hope that I understood your problem).
>

Also, when all types can be marshalled or unmarshalled as JAXB elements then
setting "marshalAsJaxbElement" and/or "unmarshalAsJaxbElement"
property can be a simpler option

Cheers, Sergey

>
> Stephen
>
> --
> Stephen Evanchik
> http://stephen.evanchik.com
>

Reply via email to