Hi David,

Thanks for the info, but my colleague tells me the domain object we're
using is in a different project.

We're trying to avoid having to put a dependency on CXF in that project, so
our option now would be to create a copy of that domain object in our
project and then apply the propOrder property.

Problem is, copying that object (which can contain thousands of rows of
data) can be expensive.

Is there a way to tell CXF to just follow / honor the order of the
properties in the source domain object ?

Regards,
Danny

On Tue, Jun 12, 2012 at 12:11 PM, KARR, DAVID <[email protected]> wrote:

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