Author Info
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.

About Chris Work with Chris
Looking for pain-free PeopleSoft web services? 😀
PeopleSoft Simple Web Services (SWS)

Introducing a small but powerful PeopleSoft bolt-on that makes web services very easy. If you have a SQL statement, you can turn that into a web service in PeopleSoft in a few minutes.

Contents

Application Service Framework

This is some new functionality release with PeopleTools 8.57.07.

A new framework delivered in PeopleTools 8.57.07. This framework allows us to expose application logic written in Application classes as Rest Services with a generic endpoint. Each endpoint could be used to serve a specific functional purpose. This framework uses the delivered authentication process for ODA.

The Application Service Framework requires 8.57 PeopleTools and can be found in:

PeopleTools->Integration Broker->Web Services->Application Services->Application Services.

The role PTCB_ADMINISTRATOR is required and custom AppClasses must extend the delivered AppClass PTCBAPPLSVCDEFN:ApplicationServiceBase and implement the method invokeService. %this.ServiceAPI property is the delivered API to read and write parameters.

Steps

  • First Give yourself this role: PTCB_ADMINISTRATOR

PTCBREGWIZ

Research

Example Service

what is the end point?

Application Package: EOCB_CORE_API:GetMsgCatalogs

import PTCBAPPLSVCDEFN:ApplicationServiceBase;


class GetMsgCatalogs extends PTCBAPPLSVCDEFN:ApplicationServiceBase
   method invokeService();
   
end-class;


method invokeService
   /+ Extends/implements PTCBAPPLSVCDEFN:ApplicationServiceBase.invokeService +/
   
   Local number &setNum;
   Local array of number &arrMsgCatalogNums;
   Local JsonArray &inputMsgNum;
   Local JsonObject &jsRetObject, &jsMsgSetObj, &jsTempMsgCat;
   Local number &I, &J, &numMsgCat;
   
   &setNum = %This.ServiceAPI.getInputParameter("MsgSetNumber");
   
   &jsRetObject = CreateJsonObject();
   
   If &setNum > 0 Then
      
      &inputMsgNum = %This.ServiceAPI.getInputParameter("MsgCatalogNumList");
      
      Local Rowset &rsMsgSet;
      
      &rsMsgSet = CreateRowset(Record.PSMSGCATDEFN);
      &rsMsgSet.Fill("Where MESSAGE_SET_NBR = :1", &setNum);
      &jsMsgSetObj = CreateJsonObject();
      
      If &inputMsgNum.Length() > 0 Then
         &arrMsgCatalogNums = CreateArrayRept(&numMsgCat, 0);
         
         For &J = 1 To &inputMsgNum.Length()
            &arrMsgCatalogNums.Push(&inputMsgNum.GetElement(&J));
         End-For;
         
         For &I = 1 To &rsMsgSet.ActiveRowCount
            &numMsgCat = &rsMsgSet(&I).PSMSGCATDEFN.MESSAGE_NBR.Value;
            If &arrMsgCatalogNums.Find(&numMsgCat) > 0 Then
               &jsMsgSetObj.AddProperty("" | &rsMsgSet(&I).PSMSGCATDEFN.MESSAGE_NBR.Value, &rsMsgSet(&I).PSMSGCATDEFN.MESSAGE_TEXT.Value)
            End-If;
         End-For;
         
      Else
         
         For &I = 1 To &rsMsgSet.ActiveRowCount
            &jsMsgSetObj.AddProperty("" | &rsMsgSet(&I).PSMSGCATDEFN.MESSAGE_NBR.Value, &rsMsgSet(&I).PSMSGCATDEFN.MESSAGE_TEXT.Value)
         End-For;
         
      End-If;
      
      &jsRetObject.AddJsonObject("" | &setNum, &jsMsgSetObj);
      %This.ServiceAPI.setOutputParameter("MsgCatBundleObject", &jsRetObject);
      %This.ServiceAPI.ResultState = "SUCCESS";
   Else
      %This.ServiceAPI.ResultState = "MISSINGPARAMETER";
   End-If;
   
end-method;

Generic Handler is: PTCBAPPLSVCDEFN.PTCBSVC.GetHandler

PSOPRHDLR;

SELECT * fROM PSOPERATIONAC WHERE PACKAGEROOT = ‘PTCBAPPLSVCDEFN’;

These two operations

PTCB_APPL_SVC_GET PTCB_APPL_SVC_POST