Contents
Contents

REST Run-time Detection and Code Samples

Struggling to bridge the legacy gap? Cedar Hills Group provides specialized PeopleSoft integration consulting to help teams design, build, and optimize their connection strategies.

This section is going to cover some code samples related to REST handlers.

Detecting if the Handler is running under REST or HTTP Context

There are time where you may need to create a Service Operation Handler that serves both REST and HTTP services. Most of the code in the handler might be the same between those two. The real difference is generally how you detect parameters. This can be useful when you do not want to duplicate code and you need to serve legacy and new clients. This section will not pertain to all readers in practice.

First let’s take a look at how we can determine at run-time if the service is running under a REST web service setup.

  • You can check the URIResourceIndex property on the Request message object. If it is greater than 0 then you are running under REST.
  • If the value is less than or equal to 0 then you are running under HTTP.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import PS_PT:Integration:IRequestHandler;

class syncTest implements PS_PT:Integration:IRequestHandler
   method onRequest(&msgRequest As Message) Returns Message;
end-class;

method onRequest
   /+ &msgRequest as Message +/
   /+ Returns Message +/
   /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/

   Local Message &msgReturn = CreateMessage(@("Operation." | &msgRequest.OperationName), %IntBroker_Response);


   Local XmlDoc &xmlout;
   &xmlout = CreateXmlDoc("<?xml version='1.0'?><response/>");


   local boolean &bIsREST = false;

   if &msgRequest.URIResourceIndex > 0 then
     &bIsREST = true;
   end-if;


   &response.SetXmlDoc(&xmlout);
   Return &response;

end-method;

Detecting REST method

There are a few ways to structure your REST Services when you have multiple Methods:

  • GET
  • POST
  • DELETE

You can:

  • Have a different handler for each HTTP Method - (I don’t recommend this)
  • Have a one handler that processes all methods. (Recommended)

When you have a single handler processing different HTTP Methods you are going to need to detect the HTTP Method at run-time and take the appropriate action. Here is a code sample that shows how to detect the HTTP Method.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import PS_PT:Integration:IRequestHandler;

class syncTest implements PS_PT:Integration:IRequestHandler
   method onRequest(&msgRequest As Message) Returns Message;
end-class;

method onRequest
   /+ &msgRequest as Message +/
   /+ Returns Message +/
   /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/


   Local Message &msgReturn;
   &msgReturn = CreateMessage(@("Operation." | &msgRequest.OperationName), %IntBroker_Response);


   Local XmlDoc &xmlout;
   &xmlout = CreateXmlDoc("<?xml version='1.0'?><response/>");

    Evaluate %This.getRequestMessage().HTTPMethod
      When %IntBroker_HTTP_GET
         /* do some logic */
         Break;
      When %IntBroker_HTTP_POST
         /* do some logic */
         Break;
      When %IntBroker_HTTP_DELETE
         /* do some logic */
         Break;
      When %IntBroker_HTTP_PUT
         /* do some logic */
         Break;
         
      When %IntBroker_HTTP_HEAD
         /* do some logic */
         break;
    End-Evaluate;
 

   &response.SetXmlDoc(&xmlout);
   Return &response;

end-method;

Detecting Content Type

  • TODO

Detecting Accept Type

  • TODO
Author Profile
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with over two decades of experience. He is available for consulting engagements.

Work with Chris
Subscribe to Updates
SWS Bolt-On
PeopleSoft Simple Web Services

SWS turns SQL into production REST APIs — ready for AI, modern apps, and partner integrations. One install, unlimited potential.

  • Configuration-driven, no coding required
  • JSON, XML, and CSV output
  • Works across all PeopleSoft pillars
  • Built on 25+ years of PeopleSoft expertise
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

A powerful PeopleSoft bolt-on that makes REST web services easy. You bring the SQL, SWS handles the rest.

  • Go from idea to production in minutes
  • Zero code migrations after install
  • JSON, XML, and CSV output supported
  • No PeopleCode or Integration Broker expertise required
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

Traditional PeopleSoft web services cost $3,600–$13,000 each to develop. SWS deploys production REST APIs in under 5 minutes through configuration alone.

  • No PeopleCode or Integration Broker expertise required
  • Works across Campus Solutions, HCM, and Financials
  • Built-in pagination, caching, and nested data structures
  • Trusted by institutions across higher education and government
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

Turn PeopleSoft data into clean REST APIs for AI integrations, modern applications, and vendor data feeds. Configuration-driven — no PeopleCode required.

  • Deploy production APIs in under 5 minutes
  • AI and LLM ready (RAG, chatbots, intelligent search)
  • JSON, XML, and CSV output
  • Zero modifications to delivered PeopleSoft objects
Read More & Purchase
psLens Platform
psLens Operations & Intelligence

Look up any record, field, page, or component, audit security, and monitor Integration Broker across every database — in seconds.

  • 30+ object types browsable
  • 16 real-time alert types
  • Read-only by design
  • No App Designer or SQL required
Learn More
psLens Platform
psLens Operations & Intelligence

A web console built for the PeopleSoft community — operational monitoring, security auditing, and metadata browsing in one tool.

  • Sub-second object search
  • Catch stuck IB messages before users do
  • Audit service permissions from one screen
  • Works in any browser
Learn More
psLens Platform
psLens Operations & Intelligence

On-demand security and operational reports for your PeopleSoft environment — no client install required.

  • 14 on-demand reports
  • Markdown export for AI/LLM workflows
  • No shared tenancy
  • Built on 25+ years of PeopleSoft expertise
Learn More
psLens Platform
psLens Operations & Intelligence

Research any PeopleSoft object and monitor system health from a single browser tab — no App Designer, no SQL.

  • 30+ PeopleSoft object types browsable
  • Real-time alerts before users report problems
  • Read-only and secure
  • Private alpha — early access now
Learn More