Hello All ,
I have a new RDMLX function created in windows server using the commands below.
On this server this runs OK!
Fuction is checked to Iseries. It's been called in a batch job from RDML function. .
This doesn't work. Error ,Message
Bericht-ID . . . . . . : CPF9898
Datum verzending . . . : 02/06/22 Tijdstip verzending . : 07:34:24
Bericht . . . . : Fatal Error : Process : LVSMOL RDML RPG Interface
Function : EABMOL Statement : 0 Message : (0168) - Recursive invocation of
RDML level function detected. Routine : X_Add_to_Invocation_Stack.
I don't be sure if this kind of function can run on the Iseries.
Maybe some system parameters have to be set. t
Maybe there are tips&tricks
Thanks
Twan
Define_Com Class(#XPRIM_Json) Name(#json)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonpartijObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonkenmerkObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonfotoObj) Reference(*DYNAMIC)
* array
Define_Com Class(#XPRIM_JsonArray) Name(#jsonpartijArray) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonArray) Name(#jsonkenmerkArray) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonArray) Name(#jsonfotoArray) Reference(*DYNAMIC)
* token
Define_Com Class(#MOAPIAUT) Name(#MOAPIAUT)
Define_Com Class(#Prim_dc.UnicodeString) Name(#u_Token)
Define_Com Class(#XPRIM_HttpRequest) Name(#u_Request)
*
Define_Com Class(#XPRIM_Json) Name(#u_JsonRequest)
Define_Com Class(#XPRIM_Json) Name(#u_JsonResponse)
Define_Com Class(#XPRIM_JsonObject) Name(#u_JsonObject) Reference(*DYNAMIC)
* Log tijdelijk
Define_Com Class(#rpHttpLogging) Name(#RPHTTPLOGGING)
#RPHTTPLOGGING.mSetLogging( TRUE )
* make root of JSON document
#jsonObj <= #json.CreateRootObject
* add Bearer token
#u_Request.Options.AddBearerAuthorization( #u_Token )
#tokenval := #u_Token.AsNativeString
#jsonObj.Insertstring Key('aanvoerDatum') String(#aanvdatum)
#jsonObj.Insertstring Key('veilDatum') String(#veildatum)
#jsonObj.Insertstring Key('typeLadingDrager') String(#llm)
#jsonObj.SerializeToFile Path(#PATHNAMDOC)
#u_Request.Content.AddJson Value(#json)
#U_Request.DoPost( #HTTPpost )
JSON Iseries batchjob
Re: JSON Iseries batchjob
Hi,
I tried your code in my as400 with a few changes (just for the missing field definitions and values) and it works fine... I can see a response from the server:
this is the code I used:
maybe you have some miss configuration, suggestion will be to open a case and review your installation.
I tried your code in my as400 with a few changes (just for the missing field definitions and values) and it works fine... I can see a response from the server:
this is the code I used:
Code: Select all
Function Options(*DIRECT)
Define_Com Class(#XPRIM_Json) Name(#json)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonpartijObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonkenmerkObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonfotoObj) Reference(*DYNAMIC)
* array
Define_Com Class(#XPRIM_JsonArray) Name(#jsonpartijArray) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonArray) Name(#jsonkenmerkArray) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonArray) Name(#jsonfotoArray) Reference(*DYNAMIC)
* token
* Define_Com Class(#MOAPIAUT) Name(#MOAPIAUT)
Define_Com Class(#Prim_dc.UnicodeString) Name(#u_Token)
Define_Com Class(#XPRIM_HttpRequest) Name(#u_Request)
*
Define_Com Class(#XPRIM_Json) Name(#u_JsonRequest)
Define_Com Class(#XPRIM_Json) Name(#u_JsonResponse)
Define_Com Class(#XPRIM_JsonObject) Name(#u_JsonObject) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_OSUtil) Name(#OSUtil)
* ADDED THIS EXTRA LINES BEGIN ************************************************
If ('*OSAPI = IBMI')
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_CONFIG') Value('/tmp/lansaxlib.configas400.json')
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_TRACEPATH') Value('/LANSA_G14PGMLIB/tmp/log.txt')
Else
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_CONFIG') Value('c:\temp\lansaxlib.config.json')
#OSUtil.SetEnvironmentVariable Name('LANSA_XLIB_TRACEPATH') Value('c:\temp\log1.txt')
Endif
Define Field(#tokenval) Reffld(#STD_STRNG)
Define Field(#aanvdatum) Reffld(#STD_STRNG)
Define Field(#veildatum) Reffld(#STD_STRNG)
Define Field(#llm) Reffld(#STD_STRNG)
Define Field(#pathnamdoc) Reffld(#STD_STRNG)
Define Field(#httppost) Reffld(#STD_STRNG)
#httppost := 'http://jsonplaceholder.typicode.com/todos/1'
* ADDED THIS EXTRA LINES END ************************************************
* Log tijdelijk
* Define_Com Class(#rpHttpLogging) Name(#RPHTTPLOGGING)
* #RPHTTPLOGGING.mSetLogging( TRUE )
* make root of JSON document
#jsonObj <= #json.CreateRootObject
* add Bearer token
#u_Request.Options.AddBearerAuthorization( #u_Token )
#tokenval := #u_Token.AsNativeString
#jsonObj.Insertstring Key('aanvoerDatum') String(#aanvdatum)
#jsonObj.Insertstring Key('veilDatum') String(#veildatum)
#jsonObj.Insertstring Key('typeLadingDrager') String(#llm)
#jsonObj.SerializeToFile Path(#PATHNAMDOC)
#u_Request.Content.AddJson Value(#json)
#U_Request.DoPost( #HTTPpost )
-
Tim McEntee
- Posts: 57
- Joined: Thu May 26, 2016 8:46 am
Re: JSON Iseries batchjob
My experience is you can get random inexplicable errors when calling RDMLX from RDML programs and vice-versa.
Try creating a stub with very little code where your RDML program calls the stub which then calls the complex RDMLX. Try the stub as an RDML then as an RDMLX.
No guarantee that this will fix your problem.
Try creating a stub with very little code where your RDML program calls the stub which then calls the complex RDMLX. Try the stub as an RDML then as an RDMLX.
No guarantee that this will fix your problem.
-
cesarrafael
- Posts: 32
- Joined: Tue Dec 01, 2015 3:44 am
Re: JSON Iseries batchjob
How are you performing the "CALL"? The message suggests that you're trying to run a LANSA when you're already inside a LANSA environment. Like when you have a function that calls a CL program that calls a LANSA function...This will result in a recursive call to LANSA..