Hi,
I Did another check to this, added information now in a test file (TESTLOG) to see if the values are been received or not. And they are.
The thing to be careful is capitals and lowercase values for the password in particular that are received in the API, I get this kind of log:
Code: Select all
20210609174032 T19_LOGONVALIDATION g14raultst
20210609174039 T19_ServerSystemManager g14raultst
G14RAULTSTtemporal
IPINVALID PASSWORD.
and the password is correct, but looks like the problem is length of the field password, or trim, or something like that. It works fine if you call the CL from the command line without extra spaces, so, something around that.
My logon validation have now this lines, note the insert in the testlog which creates the first line you saw before:
Code: Select all
* The Persistent_ApplicationString's 1 through 5 can be used to pass information to you
* own web service routines. For this example we will just return them as example strings.
* #Persistent_ApplicationString1 := "Example string 1"
#Persistent_ApplicationString1 := #UserProfiletoCheck
#Persistent_ApplicationString2 := #PasswordToCheck
#Persistent_ApplicationString3 := "Example string 3"
#Persistent_ApplicationString4 := "Example string 4"
#Persistent_ApplicationString5 := "Example string 5"
#STD_STRNG := #DATETIMEX.now.AsDisplayString( CCYYMMDDHHMMSS ) + ' T19_LOGONVALIDATION ' + #Persistent_ApplicationString1.AsNativeString
Insert Fields(#STD_STRNG) To_File(TESTLOG)
This lines in my server manager, value is received there as you can see in the log before:
Code: Select all
Use Builtin(SET_SESSION_VALUE) With_Args(USER_AUDIT #PersistentString1.AsNativeString)
* https://%lansadocs%/lansa015/index.htm#lansa/ladtgub4_user_variables.htm?Highlight=USER_AUDIT
#STD_STRNG := #DATETIMEX.now.AsDisplayString( CCYYMMDDHHMMSS ) + ' T19_ServerSystemManager ' + #PersistentString1.AsNativeString
Insert Fields(#STD_STRNG) To_File(TESTLOG)
Define Field(#tempuser) Type(*CHAR) Length(10)
Define Field(#temppass) Type(*CHAR) Length(32) Input_Atr(LC)
#tempuser := #PersistentString1.AsNativeString.UpperCase
#temppass := #PersistentString2.AsNativeString
Call Pgm(TESTCHGJOB) Parm(#tempuser #temppass)
and this is the status of the testchgjob CL which calls the API:
Code: Select all
PGM (&USERPROF &PASSWORD)
/* RECEIVED PARMS */
DCL VAR(&USERPROF) TYPE(*CHAR) LEN(10)
DCL VAR(&PASSWORD) TYPE(*CHAR) LEN(32)
DCL VAR(&CHANGEJOB) TYPE(*CHAR) LEN(1)
DCL VAR(&CHANGELIBL) TYPE(*CHAR) LEN(1)
DCL VAR(&HANDLE) TYPE(*CHAR) LEN(12)
/* RETURNED PARMS */
DCL VAR(&RETCODE) TYPE(*CHAR) LEN(2)
DCL VAR(&ERRORMSG) TYPE(*CHAR) LEN(132)
DCL &SQLSTMT TYPE(*CHAR) LEN(1000)
DCL "E *CHAR 1 VALUE('''')
CHGVAR VAR(&PASSWORD) VALUE(%TRIM(&PASSWORD))
CHGVAR VAR(&SQLSTMT) VALUE('INSERT INTO TESTLOG +
(STD_STRNG, @@UPID)' || ' VALUES(' || +
"E || &USERPROF || &PASSWORD || +
"E || ', 1)')
SNDPGMMSG &SQLSTMT
RUNSQL SQL(&SQLSTMT) COMMIT(*NONE)
MONMSG CPF0000
CALL PGM(CHGJOBUSR) PARM(&USERPROF &PASSWORD Y N +
&HANDLE &RETCODE &ERRORMSG)
CHGVAR VAR(&SQLSTMT) VALUE('INSERT INTO TESTLOG +
(STD_STRNG, @@UPID)' || ' VALUES(' || +
"E || &RETCODE || &ERRORMSG || "E +
|| ', 1)')
SNDPGMMSG &SQLSTMT
RUNSQL SQL(&SQLSTMT) COMMIT(*NONE)
MONMSG CPF0000
WRKSPLF OUTPUT(*PRINT)
ENDPGM
I dont see a problem with the LANSA code, the thing to find is how to receive the password correctly for the API... will play more with this later. maybe length of the parm, or something else with the trim, but the value is been received correctly in the CL.
If you try with this code, the TESTLOG have only one field, STD_STRNG, and you may want to do a CLRPFM TESTLOG before try each run.