Web Connection Wishlist
WebConnection can't load JSONSERVICE
Gravatar is a globally recognized avatar based on your email address. WebConnection can't load JSONSERVICE
  Patricio
  All
  Jul 2, 2025 @ 07:33am

Hi Rick, I am trying to fire up WebConnection binding a VFP app and it reports that can“t find JSONSERVICE. Any ideas?

Gravatar is a globally recognized avatar based on your email address. re: WebConnection can't load JSONSERVICE
  Rick Strahl
  Patricio
  Jul 2, 2025 @ 06:26pm

That would be because there is no JsonService class...

You need to provide more context for the error, but if this is the actual error message it's not coming from Web Connection's core but your own code.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: WebConnection can't load JSONSERVICE
  Patricio
  Patricio
  Jul 3, 2025 @ 03:16am

When execution goes into this part of file Process.prg it fail to set this line: JSONservice.IsRawResponse=.t.

with error "Object JSONservice is not found"

*************************************************************
*** PUT YOUR OWN CUSTOM METHODS HERE                      
*************************************************************

function sysSetup(pData)
JSONservice.IsRawResponse=.t.
api.LogData("sysSetup","")
xPractice=Request.Form("practice")
xUserName=Request.Form("username")
xResponse=api.SysSetUp()
api.LogData("sysSetup",xResponse)
response.write(xResponse)

return 
endfunc
Gravatar is a globally recognized avatar based on your email address. re: WebConnection can't load JSONSERVICE
  Tore Bleken
  Patricio
  Jul 3, 2025 @ 03:32am

You clearly have missed to create the object JSONSERVICE. You can't address an object that's not created...
You are missing a CreateObject() or NewObject() command.

Gravatar is a globally recognized avatar based on your email address. re: WebConnection can't load JSONSERVICE
  Rick Strahl
  Patricio
  Jul 3, 2025 @ 07:49am

Assuming you are using a wwRestProcess subclass:

Taking a look, and it seems there's an issue with the scoping of the PRIVATE JsonService variable. JsonService is at the wrong level so it's not visible in your process code. However, you can use this.oJsonService (which is what's assigned to JsonService as a convenience) and that will work for now.

The other 'convenience' variable is Serializer and that works correctly.

I've fixed the issue for a future update and it will work in the future.

If you want to fix this yourself you can go into the source code and fix the following line in wwProcess.prg and the wwRestProcess::RouteRequest() method:

Change:

PRIVATE Serializer, Service

to

PRIVATE Serializer, JsonService

+++ Rick ---

© 1996-2025