Hi Doug

So unless there is some JAXB annotation stuff for arrays in java beans,
I'm guessing both the in and out JSON to XML JAXRS convertors may be broken?

This is a grey area for me. Default JSON converter does not do anything but delegating to a Jettison library. Likewise, I'm not sure if there's some JAXB annotation which can be used to annotate arrays to give some hint to a JAXB (de)serializer...

Does anyone know what might be happening here ?

i.e., the d2x array soaked up all trailing MachineData bean parameters
in the emitted JSON representation.

I'm just wondering, would it work if a d2x array were placed as the last entry in the CrystalParams's class/schema, as a workaround ?

Cheers, Sergey


Actually there is something funny going wrong with the JSON
emitted by the JAXRS process. This was just a dummy service to
see the output format:

@GET
@Path("get/{clientId}")
@ProduceMime("application/json")
public CrystalParameters dummy(@UriParam("clientId") String id, @HttpContext
UriInfo info) {
CrystalParameters  cpn = new CrystalParameters();
MachineData md = new MachineData();
md.setWavelength(0.7);
md.setD2x(new double[] {1.0,0,0,0,1.0,0,0,0,1.});
md.setBottomOffset(50.);md.setUpperOffset(50.);
md.setLeftOffset(50.); md.setRightOffset(50.);
cpn.setMachineData(md);
return cpn;
}

When I did a wget on this service it gave me JSON:
{"CrystalParameters":{"machineData":{"bottomOffset":50,"d2x":
[1,0,0,0,1,0,0,0,1,50,50,50,0.7]}}}

the XML precursor was, from my previous email:

<machineData><bottomOffset>50.0</bottomOffset>
  <d2x>1.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>1.0</d2x>
  <d2x>0.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>1.0</d2x>
  <leftOffset>50.0</leftOffset><rightOffset>50.0</rightOffset>
  <upperOffset>50.0</upperOffset><wavelength>0.7</wavelength>
</machineData>

i.e., the d2x array soaked up all trailing MachineData bean parameters
in the emitted JSON representation.

So unless there is some JAXB annotation stuff for arrays in java beans,
I'm guessing both the in and out JSON to XML JAXRS convertors may be broken?

Thanks for any info.
Doug

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to