Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Sunday, August 2, 2020

PeopleSoft Reporting Web Services

While browsing through Peoplebooks for API syntax I ran into this topic related to Reporting web services and I was pleasantly surprised that this feature is available out of the box but I don't think is used frequently. Looks like it has been around since 8.56.x  or maybe even before. So PeopleSoft provides SOAP as well as REST based web services to expose PeopleSoft data based on PS Query or Connected query to external systems. I think this is pretty cool. So as long as the data set can be constructed in PS Query or Connected Query it can be exposed out to a 3rd party service using out of the box infrastructure. This greatly simplifies elaborate design and development time of application engine programs which are generally used for building interfaces.

PeopleSoft provides QAS_QRY_SERVICE which is the service for Query Access Manager.
and PROCESSREQUEST which is the service for Process Scheduler. Via these services once can create and get query and process request type items. I tried out the query service to execute a query via Postman and it works like a charm.

There is lot of good info in PeopleBooks so I won't repeat all of that here. So I currently have two RSS feeds based on PS Query which I use for monitoring the status of process monitor processes and jobs and another one which monitors the asynchronous  services. I used these as the test cases to fetch data using the web services instead of RSS. Also setup a user which has access to the service operation and to the queries and can only run the queries. 

As I have the queries already built I tested out the REST service operation QAS_EXECUTEQRY_REST_GET to execute the queries. 

Example of the URI Template:
{OwnerType}/{QueryName}/{OutResultType}/{OutResultFormat}?isconnectedquery=
{isConnectedQuery}&maxrows={MaxRow}&prompt_psqueryname={Prompt_PSQueryName*}
&prompt_uniquepromptname={Prompt_UniquePromptName*}&prompt_fieldvalue=
{Prompt_FieldValue*}&filterfields={FilterFields*}&json_resp={json_response}
Provided QueryName, OwnerName is PUBLIC as the query I am using is public query, OutResultType is JSON as I want the results back in JSON format, OutResultFormat is NONFILE as I want the response in message object, isconnectedquery = N, maxrows set it to 100 ( I would never get so many rows back), json_resp set it to true, did not set anything for rest of the URI parameters. 

HTTP GET https://myserver/PSIGW/RESTListeningConnector/PSFT_HR/ExecuteQuery.v1/PUBLIC/N_MY_QUERY/JSON/NONFILE?isconnectedquery=N&maxrows=100&prompt_psqueryname=&prompt_uniquepromptname=&prompt_fieldvalue=&filterfields=&json_resp=true 


The response is received as follows:

{
   "status":"success",
   "data":{
      "query":{
         "numrows":3,
         "queryname=":"N_MY_QUERY",
         "rows":[
            {
               "attr:rownumber":1,
               "PRCSINSTANCE":558373,
               "MAINJOBINSTANCE":558373,
               "PRCSJOBNAME":"MYJOB",
               "PRCSTYPE":"PSJob",
               "PRCSNAME":"MYPRCS",
               "OPRID":"PS",
               "RUNCNTLID":"MYRUN",
               "RECURNAME":"Daily",
               "RUNDTTM":"2020-07-04T12:15:00-0400",
               "RUNSTATUS":"Processing",
               "DISTSTATUS":"Scheduled"
            },
            {
               "attr:rownumber":2,
               "PRCSINSTANCE":558374,
               "MAINJOBINSTANCE":558373,
               "PRCSJOBNAME":"MYJOB",
               "PRCSTYPE":"SQR Process",
               "PRCSNAME":"MYSQRPRCS",
               "OPRID":"PS",
               "RUNCNTLID":"MYRUN",
               "RECURNAME":"Daily",
               "RUNDTTM":"2020-07-04T12:15:00-0400",
               "RUNSTATUS":"Processing",
               "DISTSTATUS":"Scheduled"
            },
            {
               "attr:rownumber":3,
               "PRCSINSTANCE":558375,
               "MAINJOBINSTANCE":558373,
               "PRCSJOBNAME":"MYJOB",
               "PRCSTYPE":"SQR Report",
               "PRCSNAME":"MYPROCESS",
               "OPRID":"PS",
               "RUNCNTLID":"MYRUN",
               "RECURNAME":"Daily",
               "RUNDTTM":"2020-07-04T12:15:00-0400",
               "RUNSTATUS":"Pending",
               "DISTSTATUS":"Scheduled"
            }
         ]
      }
   }
}


Following is an example when query does not return any results.

{
   "status":"success",
   "data":{
      "query":{
         "numrows":0,
         "queryname=":"N_MY_QUERY",
         "rows":[

         ]
      }
   }
}

Sunday, August 12, 2018

Windows App/Prcs Service Management

Tools 8.56.07 and HCM 9.2 installed via classic method (non-DPK)

Created one PS_CFG_HOME pointing to E:\pscfg
Under this I have 
appserv
appserv\DEV
appserv\TST
appserv\prcs\DEV
appserv\prcs\TST

So if I use PS_HOME\appserv\psadmin to create service for the above config then it will create one service for both the application servers and process schedulers. So if I need to start/stop one domain or just the app or prcs of one domain then its not possible.

The service created via psadmin runs the command
PS_HOME\bin\server\winx86\psntsrv.exe "E:\pscfg"
which basically applies to all domains under PS_CFG_HOME.

So I used Ruby which is packaged with the DPK installables to create 4 unique services so that I can start/stop each service individually. I had downloaded PUM26 DPK so used the setup folder and PT-DPK-WIN-8.56.07-1of2.zip and PT-DPK-WIN-8.56.07-2of2.zip from that location. 
Ran the following command in my CMD session as admin


psft-dpk-setup.bat --env_type midtier --domain_type appbatch

The initial part will install the puppet software, which is what we need. Quit the installation once that was done.

Created appserver_win_service.rb under each application server domain and prcs_win_service.rb under each process scheduler domain. Took the one created for PUM as a sample and then editted that accordingly.

Then create the service manually in the CDM session.

Application Server

sc create PsftAppServerDomain{name_of_domain}Service DisplayName= PsftAppServerDomain{name_of_domain}Service binpath= "C:\PROGRA~1\PUPPET~1\Puppet\sys\ruby\bin\ruby.exe E:\pscfg\appserv\{name_of_domain}\appserver_win_service.rb" group= Network

sc description PsftAppServerDomain{name_of_domain}Service "PeopleSoft AppServer Domain {name_of_domain} Service"

Process Scheduler 

sc create PsftPrcsDomain{name_of_domain}Service DisplayName= PsftPrcsDomain{name_of_domain}Service binpath= "C:\PROGRA~1\PUPPET~1\Puppet\sys\ruby\bin\ruby.exe E:\pscfg\appserv\prcs\{name_of_domain}\prcs_win_service.rb" group= Network

sc description PsftPrcsDomain{name_of_domain}Service "PeopleSoft Prcs Domain {name_of_domain} Service"


Start application server and process scheduler manually first via the classic psadmin method. Once both start cleanly shutdown both via psadmin and then attempt to start via service.

My new service executes a command like below
Path_to_ruby.exe E:\pscfg\appserv\{name_of_domain}\appserver_win_service.rb

I created the config file appserver_win_service.rb which is a text file with ruby commands which in turn uses psadmin command line to start/stop service.

So I have 4 .rb files for each service.