Introducing 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.Read More & Purchase
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.
In this example, we create a new service.
Now we need to create some PeopleCode that will run when a new message is posted to the integration broker for this Service Operation.
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:
OnNotifydoes NOT return anything.
Now we need to setup the actual Service Operation. There are several steps here.
|Service Operation Attribute||Value|
|Type||Asynchronous - One Way|
|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 Type||On Notify|
Now we need to setup the routing to make this node able to send Service Operations.
|Service Operation Routing Attribute||Value|
|Receiver Node||PSFT_CS (whatever your default local node is )|
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/>
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.