This is a two part question
First part(I)
==========
How are these two way different?
1. <xs:element name="elemname" type="tns:elem_type" />
<xs:complexType name="elem_type">
<xs:sequence>
<xs:element name="elem1" type="ns1:elem1_type"/>
</xs:sequence>
</xs:complexType>
2. <xs:element name="element">
<xs:complexType>
<xs:sequence>
<xs:element name="comment" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
The second one is generating the @XmlRootElement(name = "comments") whereas
the first one is not when it goes through xjc .Any idea ? Is there a way to
specify the element to be root in the schema? Is xjc program the culprit(I
have tried with both the maven plugin and the xjc.bat way of generating the
java classes)
=======================================================================================
The second part is as follows.(II)
When I try to use the jersey client wrapper and have the request to be
one without the XmlRootElement (I way)
clientResponse =
createWebResource().accept(contentType).post(ClientResponse.class, request);
I get the following error message
com.sun.jersey.api.client.ClientHandlerException:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:128)
at com.sun.jersey.api.client.Client.handle(Client.java:397)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
Can jersey client only send root elements @XmlRootElement?
Regards