Friday 17 February 2017

Providing REST Web Service from PeopleSoft



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:
  1. Create documents for request and response.
  2. Create request and response messages based on the above created documents.
  3. Create REST service.
  4. Create GET service operations.
  5. Give security to Service Operations.
  6. Create handler application class and assign it to the service operation.
  7. Test the REST web service.

  1. 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
  1. 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.
  1. Create REST service

Navigate to PeopleTools Integration Broker Integration Setup Services


Click Add

Save the changes.

  1. 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.
  1. 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.
  1. 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




12 comments:

  1. We are developing a REST service where we need to publish multiple rows for the input request message, Please tell me how to achieve it.

    ReplyDelete
  2. Hi I have created a REST API similar to this , if i have multiple rows in output, it is overidding and giving the last row in the table in the response , how we need to include all the rows of data in response.

    ReplyDelete
    Replies
    1. I believe what is missing from the example is the Document collection. The inner DR_EMP_RES_GET is correct, but it needs another document that has a collection and a compound child pointing to DR_EMP_RES_GET. Your Message when then point to the collection document instead of the single-item document.

      Inside your loop you will then create collection items, set properties for the new item, and then append the new item to the collection. See AppendItem in PeopleBooks at https://docs.oracle.com/cd/F13640_01/pt857pbr2/eng/pt/tpcr/langref_CollectionClassMethods-f977fa.html?pli=ul_d57e485_tpcr

      Delete
    2. Thats right Jim.. Thanks for your reply....

      Nikhil.. hope it clears your question?

      Delete
    3. I need guidance. The Orcle document is not helping me

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I am failing to get the collection part correct. please guide me

    ReplyDelete
  5. Hi.. Thanks for this..!! One question: From where did we got the URI to enter in the service operation.

    ReplyDelete
  6. Nice work Deepak :) Keep sharing good stuff like this one.

    ReplyDelete
  7. Thanks for sharing this information. I really Like Very Much.Agro Fertilizer Company in India

    ReplyDelete