Thanks Sergey,
I think it is a problem with the format of my JSON.
I can actually get my service to respond by
POSTing the following equivalent XML:

<?xml version='1.0' encoding='UTF-8'?>
<CrystalParameters>
 <cellData><a>5.0</a><alpha>5.0</alpha><b>5.0</b>
         <beta>5.0</beta><c>5.0</c><gamma>5.0</gamma>
 </cellData>
 <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>
 <scanData><chi>54.74</chi><detector>50.2</detector><direction>-</direction>
      <kappa>0.0</kappa><omega>-15.0</omega><phi>0.0</phi><scan>Omega</scan>
     <sweep>130.0</sweep><twotheta>-28.8</twotheta><width>5.0</width>
 </scanData>
 <scanData><chi>54.74</chi><detector>50.2</detector><direction>-</direction>
     <kappa>0.0</kappa><omega>-15.0</omega><phi>120.0</phi><scan>Omega</scan>
    <sweep>130.0</sweep><twotheta>-28.8</twotheta><width>5.0</width>
 </scanData>
</CrystalParameters>

but POSTing this JSON string doesn't work:

{"CrystalParameters":{"machineData":{"wavelength":0.71069,
 "d2x":[1,0,0,0,1,0,0,0,1],
 "leftOffset":0.05,"rightOffset":0.05,"upperOffset":0.05,"bottomOffset":0.05},
"scanData":[{"scan":"Omega","detector":50.2,"twotheta":-28.8,"omega":-15,
  "phi":0,"chi":54.74,"width":5,"sweep":130,"direction":"-"},  
       {"scan":"Omega","detector":50.2,"twotheta":-28.8,"omega":-15,
   "phi":120,"chi":54.74,"width":5,"sweep":130,"direction":"-"}],
"crystalData":{"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90}}}

Actually if I strip it down to just:

{"CrystalParameters":{"crystalData":
{"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90}}} 

then the service calls init correctly, but if I try to include any kind
of array data in the JSON string then the init 
just never gets called, e.g.

{"CrystalParameters":{"crystalData":
{"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90,
"ub"=[0.2,0,0,0,0.2,0,0,0,0.2]}}}

Do arrays need some special treatment? ub, like d2x above is 
expected to be just java type double[].

Thanks
Doug

Reply via email to