cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Balaji Sankar Chopparapu <balaji.choppar...@gmail.com>
Subject Re: problem while posting JSON text to RESTService
Date Wed, 23 Dec 2009 06:56:36 GMT
Thanks Sergey.

This solved the problem. I believe property "writeXsiType" is added in 2.2.5
Release.

Merry Christmas and a Happy New Year.

Best  Regards
Balaji


On Tue, Dec 22, 2009 at 8:57 PM, Sergey Beryozkin <sberyozk@progress.com>wrote:

> 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
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message