You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by amine amine <am...@gmail.com> on 2009/03/20 22:36:03 UTC

Re: [CXF2.2][IPLANET6sp6][Spring2.0.6] spring unable to find namespace

Salam,

Hi Gabo,

 I want to ask you about combining JAX-WS and JAX-RS, for me it's my
interface that contains annotations (WS & RS) and I'm using @XmlElement,
@XmlRootelement and @XmlWrapper. it works both services WS and RESTfulWS are
available, but the XML structure of the responses give double XML nodes

like this bellow (the Clients node figures two times and the expected is
only once) :
<ClientsList>
<Clients>
  <Clients>
     <Client>
     </Client>
     <Client>
     </Client>
  </Clients>
</Clients>
</ClientsList>

thank you in advance! and good luck !
-- 
Tigre et dragon "guardians of paradise"

Re: [CXF2.2][IPLANET6sp6][Spring2.0.6] spring unable to find namespace

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi amine (or Salam?),

Try the following annotations in your object declaration:

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

@XmlType(name="MyObject")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="MyObject")
public class MyObject {
    //add your getters and setters here...
}

-------------------

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement(name="MyObjectList")
@XmlType(name="MyObjectList")
@XmlAccessorType(XmlAccessType.FIELD)
public class MyObjectList {
    @XmlElement(nillable=true, name="MyObject")
    private List<MyObject> objects = new ArrayList<MyObject>();
    //add your getters and setters here...
}

I'm using default JAXB and I don't see any "duplication" of the nodes. Hth.

Gabo

P.S. I am not sure how this relates to my original question. :)

amine amine wrote:
> Salam,
>
> Hi Gabo,
>
>  I want to ask you about combining JAX-WS and JAX-RS, for me it's my
> interface that contains annotations (WS & RS) and I'm using @XmlElement,
> @XmlRootelement and @XmlWrapper. it works both services WS and RESTfulWS are
> available, but the XML structure of the responses give double XML nodes
>
> like this bellow (the Clients node figures two times and the expected is
> only once) :
> <ClientsList>
> <Clients>
>   <Clients>
>      <Client>
>      </Client>
>      <Client>
>      </Client>
>   </Clients>
> </Clients>
> </ClientsList>
>
> thank you in advance! and good luck !
>