NetTalk Central

Author Topic: JSON problem in webservice method  (Read 4798 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
JSON problem in webservice method
« on: August 28, 2017, 05:33:32 AM »
Hi,

I've been struggling with a web service method when inserting a record - it keeps on saying the record field values are blank. I've traced it down to (what I think) a problem on how the JSON class parses a string.

Attached is a small example app, showing that the JSON string contains a valid object, but when parsed it only has blank values. The code in the app is mostly copied from the generated template code, that is found in the PrimeParameters routine.

Can this be a problem in the JSON class, or do I have to change settings in the web service method? I'm using jFiles version 1.48.

Thanks
Thys

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: JSON problem in webservice method
« Reply #1 on: August 28, 2017, 05:34:30 AM »
...sorry, the attachment!

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: JSON problem in webservice method
« Reply #2 on: September 01, 2017, 08:46:03 AM »
Thys - not sure if this is related to your problem or not, but grab jFiles 1.51 and retest with that please.

Cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: JSON problem in webservice method
« Reply #3 on: September 03, 2017, 09:49:46 PM »
Bruce,

I already had 1.50 installed, and with 1.51 the JSON is still not properly parsed. I probably need to look at how the JSON is presented. Here is the specific object that I can't get parsed. Maybe you can spot the problem in the structure right away?

{
   "SessionGUID":"E7SGN6Q0EPMVOFKX",
   "MedicalAidDependant":[
      {
         "GUID":null,
         "MedicalAidMembershipGUID":"69I87A8NTJ3XUUQG",
         "PersonGUID":null,
         "Name":"Jon-jon"
      }
   ]
}

Thanks
Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: JSON problem in webservice method
« Reply #4 on: September 05, 2017, 02:28:25 AM »
You are setting Case to "As Is" (which is correct since the incoming JSON names have mixed case).

BUT your Queue declaration has no External names set. So all the field names are uppercase. (In Clarion, if External Name is not set, the the Label is used, but Labels are always uppercase since Clarion is a Case-Insensitive language.)

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: JSON problem in webservice method
« Reply #5 on: September 05, 2017, 03:07:34 AM »
I knew that the JSON case will some day cause me some measure of embarrassment...

Thanks Bruce.