A path towards PeopleSoft REST Web Service

Hi Folks,

Yet again I am starting with a new tutorial.

PeopleSoft REST Service.

Here we will be creating a GET request REST service which will be world accessible.

Before proceeding we need to take care that the minimum tools version required is 8.53.

Brief steps:

1. Create a document for input GET parameters.
2. Create message for input document for GET parameters.
3. Create an output XML.
4. Create a new message for output XML.
5. Create a new REST Service.
6. Create a new GET Service Operation.
7. Create a new Application Package that needs to be used as a Service Operation Handler.
8. Assign the Handler.
9. Enable Anynomous Node.
10. Test the Operation from outside PeopleSoft.

Step 1:

Navigation:

Main Menu->PeopleTools->Documents->Document Builder

Click on “Add a New Value” link here.

Now fill “Package”, “Document” and “Version” and click “Add”.

On Next Page, click on the root of the document and click on the “Add Primitive Child” button below (Purple one).
And add the details as in the screenshot.
And click “Save”.

Step 2:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Messages

Click on “Add a New Value” link here.

Now fill details as in screenshot and click “Add” and then click “Save”.

Step 3:

XML:

<?xml version="1.0"?><REST_TEST_OUTPUT><msgdata>Hello name</msgdata></REST_TEST_OUTPUT>

Schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document on Fri May 12 2017 18:38:05 GMT+0530 (India Standard Time) -->
<!-- with XmlGrid.net Free Online Service http://xmlgrid.net -->
<xs:element name="REST_TEST_OUTPUT">
<xs:complexType>
<xs:sequence>
<xs:element name="msgdata" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Use this example XML.

Schhema created from:

http://xmlgrid.net/xml2xsd.html

Step 4:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Messages

Click on “Add a New Value” link here.

Now fill “Type”, “Message Name” and “Message Version” and click “Add”.

Fill out the details in “Message Definition” tab as in screenshot below.

Now in schema tab click on “Add Schema”, paste the above schema and click on “OK”.

Now get back to “Message Definition” tab and click “Save”.

Step 5:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Services

Click on “Add a New Value” link here.

Now fill “Service” and check “REST Service” checkbox and click “Add”.

Fill the details as below and click on “Save”. Don’t go of te page yet.

Step 6:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Service Operations

Before going to the navigation above we need to create the REST Service Operation of GET type on the Service page only.
Fill the details as in screenshot and click “Add”.

Now it will take you to the Service Operation page. Fill the details as in the screenshots below and click on “Save”.

Now Click on “Service Operation Security” and add the permission list with “Full Access”. I have used “PTPT1000” permission list and will assign “PeopleSoft User” role to user assigned to ANONYMOUS node. And click “Save”.

Step 7:

Now we have to open Application Designer.
Create a new Application Package with the code below.

import PS_PT:Integration:IRequestHandler;
class Process implements PS_PT:Integration:IRequestHandler
method Process();
method OnRequest(&_MSG As Message) Returns Message;
method OnError(&pRequestMsg As Message) Returns string;
end-class;
method Process
end-method;

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

Local Message &request, &response;

&request = &_MSG;

Local Document &reqDOC;

&reqDOC = &request.GetURIDocument();

Local string &name;
Local integer &count;

&name = &reqDOC.GetElement("name").value;

&response = CreateMessage(Operation.REST_TEST_SOP_GET, %IntBroker_Response);

Local XmlDoc &xmlout;

&xmlout = CreateXmlDoc("<?xml version=""1.0""?><REST_TEST_OUTPUT><msgdata>Hello " | &name | "</msgdata></REST_TEST_OUTPUT>");

&response.SetXmlDoc(&xmlout);

Return &response;

end-method;

method OnError
/+ &pRequestMsg as Message +/
/+ Returns String +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnError +/

Return "Error Occured";
end-method;

Step 8:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Service Operations

Open the “Service Operation”, open the “Handlers” tab. put the “Name”, “Type” and “Implementation” as below screenshot. And click on “Details” link.

Put the Handler details as below screenshot. Click “OK” then “Save”.

Step 9:

Navigation:

Main Menu->PeopleTools->Integration Broker->Integration Setup->Nodes

To enable ANONYMOUS Node open it and check the PeopleSoft user assigned to it.

Now Provide the appropriate role to the user which contains permission list which was assigned full access in “Step 6”.

Step 10:

Get the URL from Service Operation page.
In my case URL is:

http://psfscm.peoplesoft.local:8000/PSIGW/RESTListeningConnector/PSFT_EP/REST_TEST_SOP.v1/?uname=Vipin

Logout and invoke the URL.

The URL should now be accessible and results in a response.

Thats it you have now created a new REST service in PeopleSoft.

Please comment on how was this tutorial.

Thanks for reading.

1 thought on “A path towards PeopleSoft REST Web Service”

Leave a Comment Cancel Reply

Exit mobile version