In my last article we have seen how can we consume a 3rd party rest web service in PeopleSoft. In this example we will see how can we provide a REST web service from PeopleSoft.
Here we are using a custom table to send the data based on the request from the external application. We will be using GET method to get the details from this custom table.
Input parameter in the request will be employee id.
Steps:
- Create documents for request and response.
- Create request and response messages based on the above created documents.
- Create REST service.
- Create GET service operations.
- Give security to Service Operations.
- Create handler application class and assign it to the service operation.
- Test the REST web service.
- Create documents for request and response.
Navigate to PeopleTools → Documents → Documents Builder
Add a new value
Save the changes.
Similarly create a document for response also.
NOTE: If you are creating a document where you have to include the fields of a record then you can got to PeopleTools → Document → Document Utilities → Create Document from Record
- Create messages
Navigate to PeopleTools → Integration Broker → Intergration Setup → Messages
Click on Add
Save the changes.
Create a message for response
Click on Add
Save the changes.
- Create REST service
Navigate to PeopleTools → Integration Broker → Integration Setup → Services
Click Add
Save the changes.
- Create Service Operation
Open the above created service and a service operation.
Click on Add
Save the changes.
Give security to Service Operation
Save the changes.
- Create handler application class and assign it to the service operation.
Create a application class to read the employee id from the incoming request and to send back the employee details.
Now use this as handler in the service operation.
Save the changes.
- Test the service operation
Open sendmaster or any other web service testing tool
Get the url by clicking validate link
Click on Generate URL
Use this url in sendmaster.
Similarly change the employee id to 2 and test