This section is going to cover some code samples related to REST handlers.
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.
URIResourceIndex property on the Request message object. If it is greater than 0 then you are running under REST.
|
|
There are a few ways to structure your REST Services when you have multiple Methods:
You can:
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.
|
|
Chris Malek s a PeopleTools® Technical Consultant with over two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.
Work with ChrisIntroducing 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.