> -----Original Message-----
> From: Danny Sinang [mailto:[email protected]]
> Sent: Tuesday, June 12, 2012 9:04 AM
> To: [email protected]
> Subject: REST service returns elements in unexpected order
> 
> Hello,
> 
> We're using CXF version 2.6.1 and I noticed where returning results in
> an
> order that doesn't match the order in which our properties were defined
> in
> the source Java object.
> 
> For example, our Java object has the following properties :
> 
> private String trustedPartnerLogId;
> private ModuleLogEnum module;
>  private OperationLogEnum operation;
> private Long trustedPartnerId;
> private String customerId;
>  private String sessionId;
> private String dateCreated;
> 
> 
> But the JSON output from the webservice call to CXF generates this :
> 
>          "operation": "TPO_PAGE_SESSION_CLOSE",
>          "sessionId": "wf56m3mnxhch",
>          "dateCreated": "2012-06-11T18:09:24.527935-04:00",
>          "trustedPartnerId": 1014582732321112322,
>          "customerId": "9876500005",
>          "relatedAsset": null,
>          "trustedPartnerLogId": "10fca7fb-d887-64b7-d63b-3315be395118",
>          "module": "TPM_BOOK",
> 
> 
> The relevant code is shown below.
> 
> Any idea what I missed ? Is there a config setting that I can use to
> control the element order ?

This is done with the "propOrder" property in the @XmlType annotation on your 
domain objects.  This is a list property, which specifies the names of the 
properties in your type, implicitly defining their order by the order in the 
list property.

Reply via email to