Chris Malek is a PeopleTools® Technical Consultant with two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.
About Chris 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.
In this post, I will lay out a simple example that will show how to use an HTTP client to post to the PeopleSoft Integration Broker HttpListeningConnector
. PeopleSoft will process the message Asynchronously. This will be a trivial example that will hopefully help someone jump start an integration project.
In the example laid out below:
First let’s setup the PeopleSoft side.
Now we need a PeopleSoft message object that will represent the XML that the client program will post.
Message Attribute | Value |
---|---|
Name | CHG_GENERIC |
Version | V1 |
Type | Nonrowset-based |
In this example, we create a new service.
Service Attribute | Value |
---|---|
Name | CHG_TEST |
Now we need to create some PeopleCode that will run when a new message is posted to the integration broker for this Service Operation.
CHG_ASYNC_TEST:asyncTest
import PS_PT:Integration:INotificationHandler;
class asyncTest implements PS_PT:Integration:INotificationHandler
method OnNotify(&_MSG As Message);
end-class;
method OnNotify
/+ &_MSG as Message +/
/+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/
/* Variable Declaration */
Local XmlDoc &doc;
&doc = &_MSG.GetXmlDoc();
Local XmlNode &xrootNode;;
&xrootNode = &doc.DocumentElement;
Local integer &ucount;
SQLExec("SELECT COUNT(*) FROM PSOPRDEFN WHERE ACCTLOCK = 0 ", &ucount);
end-method;
This is a really dumb example that does nothing useful. However, what we can see is we can:
&_MSG.GetXmlDoc();
method.OnNotify
does NOT return anything.Now we need to setup the actual Service Operation. There are several steps here.
Service Operation Attribute | Value |
---|---|
Name | CHG_ASYNC_TEST |
Type | Asynchronous - One Way |
Version | V1 |
Active | Checked |
Message Version | CHG_GENERIC.V1 |
Queue Name | IB_EXAMPLES (or create a new queue ) |
Now we need to hook in the CHG_ASYNC_TEST:asyncTest
application class to execute when a service operation is posted. We do this on the Handler tab of the Service Operation.
Service Operation Handler Attribute | Value |
---|---|
Handler Name | Test |
Handler Type | On Notify |
Implementation | Application Class |
Description | Tester |
Package Name | CHG_ASYNC_TEST |
Path | : |
Class ID | asyncTest |
Method | OnNotify |
Now we need to setup the routing to make this node able to send Service Operations.
Service Operation Routing Attribute | Value |
---|---|
routing name | CHG_ASYNC_TEST |
sender node | CHG_TEST_NODE |
Receiver Node | PSFT_CS (whatever your default local node is ) |
External Alias | CHG_ASYNC_TEST.V1 |
Active | Checked |
Now our PeopleTools system should be ready to receive messages from some HTTP client.
Now we can use an HTTP Client to invoke the Service operation. Remember that this is an asynchronous service. This means that the actualy onNotify
handler is actually handled at some point in the future. What we get back is a TransactionID
in both the response payload and a response HTTP header. This is the ID that can be used to lookup the message determine what the handler did and if it ran.
Here is an example request with some non-important XML payload. We are using HTTP syntax here.
POST https://ib.cedarhilllsgroup.com/PSIGW/HttpListeningConnector HTTP/1.1
OperationName: CHG_ASYNC_TEST.v1
Content-Type: text/xml
From: CHG_TEST_NODE
To: PSFT_CS
Password: vase-lawless-realty
Accept: */*
Host: ib.cedarhilllsgroup.com
accept-encoding: gzip, deflate
content-length: 35
<?xml version="1.0"?>
<helloworld/>
Response:
HTTP/1.1 200 OK
status: 200
Date: Tue, 26 Feb 2019 22:53:39 GMT
Content-Length: 213
Content-Type: text/xml; charset=UTF-8
TransactionID: 5b3efd54-3a19-11e9-bcb4-fb3330b2eab1
<?xml version="1.0"?>
<IBResponse type = "success">
<DefaultTitle>Integration Broker Response</DefaultTitle>
<StatusCode>0</StatusCode>
<TransactionID>5b3efd54-3a19-11e9-bcb4-fb3330b2eab1</TransactionID>
</IBResponse>
You can lookup the transaction ID in the IB monitor to look at the status. You can see in the “subscription contract” grid that the OnNotify
handler ran to success. This happened at some later point after the client posted. This could be a matter of seconds or hours or days depending on what is happening in the system.