Good morning (or afternoon, or evening )
I'm working on a request where a third-party software (Thingworx) is being used to perform a transaction on the ISeries. In order to do this, they call a procedure and pass a user ID, password, and the parameters for the transaction.
The first thing I do is swap to the new ID.
The code snippet below works if I use it in iNavigator (with a test ID), or when the user uses a test ID; however, whenever he tries to use his own ID, he gets Invalid Credentials. When he uses any other user ID, he gets Invalid Credentials.
No one at my company has a lot of experience with using these. Does anyone have any suggestions for us? Please? ANY hints or thoughts will be greatly appreciated!
I'm working on a request where a third-party software (Thingworx) is being used to perform a transaction on the ISeries. In order to do this, they call a procedure and pass a user ID, password, and the parameters for the transaction.
The first thing I do is swap to the new ID.
The code snippet below works if I use it in iNavigator (with a test ID), or when the user uses a test ID; however, whenever he tries to use his own ID, he gets Invalid Credentials. When he uses any other user ID, he gets Invalid Credentials.
No one at my company has a lot of experience with using these. Does anyone have any suggestions for us? Please? ANY hints or thoughts will be greatly appreciated!
PHP Code:
**** API to get the profile handle (current user/swapping "from" user) inc
D GetCurUsr PR ExtPgm('QSYGETPH')
D Current 10A options(*varsize) const
D Currpass 10A options(*varsize) const
D CurHandle 12A
**** API to get the profile handle
D GetProfile PR ExtPgm('QSYGETPH')
D UserID 10A options(*varsize) const
D Password 10A options(*varsize) const
D NewHandle 12A
D ErrorCode 256A options(*varsize)
D len 10i 0 const
D CCSID 10i 0 const
// SUBROUTINES --->
BEGSR $GetProfile;
// * Get profile handle for current user INC0306416
Callp GetCurUsr('*CURRENT ' :CURPWD :OLDHANDLE);
If ErrBytesA > 0;
// handle "invalid user profile" error
OutMsg = 'OLD HANDLE PROBLEM! ' + ErrMsgID ;
wkERROR = 'Y';
Endif;
// authenticate using API QSYGETPH
callp GetProfile(%TRIMR(InappID) : %TRIMR(INAUTH1) : newHandle:
Errords : 8 : 0 );
If ErrBytesA > 0;
// handle "invalid user profile" error
OutMsg = 'INVALID CREDENTIALS ' + ErrMsgID + ' ' + %TRIMR(INAPPID) ;
wkERROR = 'Y';
Endif;
ENDSR;
Comment