Hi Balaji

Thanks Sergey.

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

Probably yes. You really need to use it only if you do nnot want the type info go on the wire in cases when say a Customer class is returned in the signature but some subclass instance like SuperCustomer is actually returned at runtime. Otherwise just do not even specify this property


Merry Christmas and a Happy New Year.

Merry Christmas and a Happy New Year to you and indeed to all CXF users and 
developers !

thanks, Sergey


Best  Regards
Balaji


On Tue, Dec 22, 2009 at 8:57 PM, Sergey Beryozkin <[email protected]>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




Reply via email to