Hi
I think this entry is confusing Jettison on the read side :
<entry key="http://www.w3.org/2001/XMLSchema-instance" value=""/>
and you probably do not need it on the write side either, instead, just set a boolean
"writeXsiType"
to false if you do not need the hierarchy info to go on the wire
let us know please if it helps
Cheers, Sergey
Hi All,
I have problem while posting JSON text to RESTService. The service is
failing with Exception
JAXBException occurred : unexpected element (uri:"
http://www.w3.org/2001/XMLSchema-instance", local:"Customer"). Expected
elements are <{}Customer>. unexpected element (uri:"
http://www.w3.org/2001/XMLSchema-instance", local:"Customer"). Expected
elements are <{}Customer>.
I believe this the problem with namespace. Pleas suggest me a solution
JSON Text
-----------------
{"Customer":{"id":123,"name":"Balaji"}}
Customer Service
------------------
@Path("/customerservice/")
public class CustomerService {
@POST
@Path("/customers/")
public Response addCustomer(Customer customer) {
System.out.println("----invoking addCustomer, Customer name is: " +
customer.getName());
customer.setId(++currentId);
customers.put(customer.getId(), customer);
return Response.ok(customer).build();
}
}
Spring-config.xml
--------------
<util:map id="jsonNamespaceMap" map-class="java.util.Hashtable">
<entry key="http://www.w3.org/2001/XMLSchema-instance" value=""/>
</util:map>
<jaxrs:serviceBeans>
<ref bean="customerService"/>
</jaxrs:serviceBeans>
Thanks
Balaji