Hi Rowell,
Have a look at the various trainings/tutorials that are available in Actian Academy first: https://academy.actian.com/?q=OpenROAD%20JSON - they are full of examples.
Anyway, I assume that you are converting from direct DCOM connection (routing not specified or some DCOM specific settings – combination of unauthenticated/compressed)
to a connection using the “http-jsonrpc” routing (via the OpenROADJSONRPC servlet running in Tomcat).
Server side
The server application would not have to be changed.
The only item you would have to add is a JSON config file (%II_SYSTEM%\ingres\files\orjsonconfig\applicationname.json) for your application, that defines the 4GL procedures (and their parameters).
This can be created using the “JSON Configuration File Generator” utility – see
https://docs.actian.com/openroad/11.2/index.html#page/ServerRef/JsonConfig4App_Utility.htm
and https://academy.actian.com/actian-openroad-json-generators
Client side
This will currently require you to change the Initiate() method parameters: routing=
' http-jsonrpc
' and location to the URL (including the application name).
Additionally, the Call4GL() method invocations into JSON-RPC requests, which you execute via the JsonRpcRequest() method.
If you have any BYREF variables, you will have to assign the according results from the response string returned into the 4GL variables using the AssignJsonRpcResponse2Vars() function.
Example – your current code would contain something :
rv = rs.Initiate(type=RP_SHARED, image = 'comtest.img', flags = '-Tall,logonly -Lcomtest.log', location = 'yourserver'); // COM
vhello = 'HELLO';
ctr = 0;
rv = rs.Call4GL('helloworld', hellostring= BYREF(vhello), counter=BYREF(ctr));
Converting to JSON-RPC request usage this looks like this:
rv = rs.Initiate(type=RP_SHARED, image = '', routing = 'http-jsonrpc', location = 'http:://yourserver:8080/openroad/jsonrpc?app=comtest');
// jreq and jresp are StringObject
jreq.Value = '{"jsonrpc":"2.0","id":1,"method":"helloworld", "params":{"hellostring":"HELLO","counter":0,"$byref_params":"hellostring,counter"}}';
jresp = rs.JsonRpcRequest(request= jreq);
CALLPROC AssignJsonRpcResponse2Vars(jsonrpc_response=jresp, var_scope=CurExec.Scope,
byref_assign_rule='vhello=hellostring,ctr=counter');
For creating the JSON-RPC request strings you can make use of the “JSONRPC Sample Request Generator” utility.
For converting your 4GL variables/object/arrays used as parameters into JSON you can use the JsonHandler.NewJsonValue() and/or JsonObject.NewMember() methods.
You can then use the JsonHandler.Write() method to convert the JsonValue/JsonObject objects into a JSON string.
This might be some effort (if your procedure has many parameters).
And now the good news:
We have implemented a change that allows to directly use the Call4GL() method in OpenROAD on a connection that uses “http-jsonrpc” routing.
It will internally do the conversion of 4GL parameters, the JsonRpcRequest() method invocation and the assignment of the BYREF parameters.
Therefore, the only change you’ll have to do is in the Initiate() method invocation.
This change will be part of the next (upcoming) patch for OpenROAD 11.2.
HTH.
Kind regards,
Bodo.
Bodo Bergmann
Engineering Architect | OpenROAD Engineering
Actian, a division of HCLSoftware
GESELLSCHAFTSANGABEN: Actian Germany GmbH | Sitz der Gesellschaft: Halenreie 42, 22359 Hamburg | Geschäftsführung: Stephen Padgett, Marc Monahan | Handelsregister:
Amtsgericht Hamburg | HRB 135991 | USt-IdNr: DE252449897
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
openroad-user...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/openroad-users/69f8bfd0-d3e6-4e22-bb0e-74b3ea853027n%40googlegroups.com.
Hello
Please contact durwin...@hcl-software.com. We have some interesting news regarding your proposed conversion.
We have implemented a way to allow the OR 11.2.0 Windows client to convert Call4GL() method internally to JsonRpcRequest() method calls. I have a presentation that describes how to do the conversion as well. I have written a sample application that shows how to do this against the COMTEST sample application server.
It would be good to setup a meeting to discuss this further
Durwin Wright
OpenROAD Engineering
Actian, a division of HCLSOFTWARE
From: Durwin Wright <Durwin...@hcl-software.com>
Sent: Friday, November 17, 2023 8:13 AM
To: openroa...@googlegroups.com; Durwin Wright <durwin...@hcl-software.com>; Durwin Wright <Durwin...@actian.com>; Brigitte Duplenne <Brigitte...@actian.com>; Chris Clark <Chris...@actian.com>; Mahin Pandya <mahin....@actian.com>;
Bodo Bergmann <Bodo.B...@actian.com>; Bodo Bergmann <bodo.b...@hcl-software.com>
Subject: Re: [openroad-users] DCOM to JSON AppServer Conversion
Hello
Please contact durwin...@hcl-software.com. We have some interesting news regarding your proposed conversion.
We have implemented a way to allow the OR 11.2.0 Windows client to convert Call4GL() method internally to JsonRpcRequest() method calls. I have a presentation that describes how to do the conversion as well. I have written a sample application that shows how to do this against the COMTEST sample application server.
It would be good to setup a meeting to discuss this further
Durwin Wright
OpenROAD Engineering
Actian, a division of HCLSOFTWARE
--