Contents

Python HTTP Post Examples

These examples show how to use Python to post to the PeopleSoft Integration Broker HttpListeningConnector. They cover both asynchronous and synchronous service operations.

Asynchronous Post

This example posts to an asynchronous Service Operation. In PeopleTools, when you post asynchronously, the PeopleSoft code that triggers is NOT run instantaneously. It will run at some point in the future.

PeopleTools Setup

You need:

  1. An External Node to represent your Python program (e.g. PTEST with Password authentication)
  2. A Message Object (e.g. CHG_TEST.V1, Nonrowset-based)
  3. A Service (e.g. CHG_TEST)
  4. Handler PeopleCode - An OnNotify handler that processes the inbound message:
import PS_PT:Integration:INotificationHandler;

class TESTER implements PS_PT:Integration:INotificationHandler
   method OnNotify(&_MSG As Message);
end-class;

method OnNotify
   /+ &_MSG as Message +/
   /+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/

   Local XmlDoc &doc;
   &doc = &_MSG.GetXmlDoc();
   /* Process the XML here */
end-method;
  1. Service Operation (Asynchronous - One Way, with security and routing configured)

Python Script

The Python script submits an XML document to the HttpListeningConnector. The XML structure does not matter as long as the handler PeopleCode knows how to parse it.

Since this is an asynchronous service operation, there is no way for the handler code to pass information back to the Python script. For that you need a synchronous operation (see below).

Synchronous Post

If your integration requires PeopleSoft to process the message and your client needs the response immediately, you need a synchronous service operation.

Synchronous Handler PeopleCode

A synchronous request must implement the OnRequest method instead of OnNotify:

import PS_PT:Integration:IRequestHandler;

class syncTester implements PS_PT:Integration:IRequestHandler
   method onRequest(&MSG As Message) Returns Message;
end-class;

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

   Local XmlDoc &xmlDocFromPython;
   Local XmlNode &requestRootNode;
   &xmlDocFromPython = &MSG.GetXmlDoc();
   &requestRootNode = &xmlDocFromPython.DocumentElement;

   /* Setup response xml body */
   Local Message &response;
   &response = CreateMessage(Operation.CHG_SYNC_TEST, %IntBroker_Response);
   Local XmlDoc &xmlout;
   Local XmlNode &childNode;
   &xmlout = CreateXmlDoc("<?xml version='1.0'?><response/>");

   Evaluate Lower(&requestRootNode.NodeName)
   When = "helloworld"
      &childNode = &xmlout.DocumentElement.AddElement("helloworld").AddText("Hello Python");
      Break;

   When = "activeusercount"
      Local integer &ucount;
      SQLExec("SELECT COUNT(*) FROM PSOPRDEFN WHERE ACCTLOCK = 0 ", &ucount);
      &childNode = &xmlout.DocumentElement.AddElement("activeusercount").AddText(String(&ucount));
      Break;

   When-Other
      &childNode = &xmlout.DocumentElement.AddElement("error").AddText("I do not understand. Please try again. You submitted: " | &requestRootNode.NodeName);
      Break;
   End-Evaluate;

   &response.SetXmlDoc(&xmlout);
   Return &response;

end-method;

This handler examines the root node of the XML and runs different branches:

  • helloworld - Returns a greeting
  • activeusercount - Counts unlocked users in the system
  • Anything else - Returns an error message

Key Differences from Asynchronous

  • Service Operation Type is “Synchronous” instead of “Asynchronous - One Way”
  • Handler Type is OnRequest instead of OnNotify
  • The handler returns a Message object back to the caller
  • The Python client gets the response XML immediately

Summary

You can submit any XML to PeopleSoft service operations and have the handler code process it and (for synchronous) respond. The two systems just need to agree upon an XML format to exchange. The handler PeopleCode can parse the data and update PeopleSoft via SQL, Component Interface, or any other PeopleCode method.


Author Info
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with over two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.

Work with Chris
PeopleSoft REST APIs in Minutes, Not Months
PeopleSoft Simple Web Services (SWS)

SWS turns SQL into production REST APIs — ready for AI, modern apps, and partner integrations. One install, unlimited potential.

  • Configuration-driven, no coding required
  • JSON, XML, and CSV output
  • Works across all PeopleSoft pillars
  • Built on 25+ years of PeopleSoft expertise
Looking for pain-free PeopleSoft web services?
PeopleSoft Simple Web Services (SWS)

A powerful PeopleSoft bolt-on that makes REST web services easy. You bring the SQL, SWS handles the rest.

  • Go from idea to production in minutes
  • Zero code migrations after install
  • JSON, XML, and CSV output supported
  • No PeopleCode or Integration Broker expertise required
Stop Building PeopleSoft Web Services the Hard Way
PeopleSoft Simple Web Services (SWS)

Traditional PeopleSoft web services cost $3,600–$13,000 each to develop. SWS deploys production REST APIs in under 5 minutes through configuration alone.

  • No PeopleCode or Integration Broker expertise required
  • Works across Campus Solutions, HCM, and Financials
  • Built-in pagination, caching, and nested data structures
  • Trusted by institutions across higher education and government
PeopleSoft REST APIs for AI, Modern Apps, and Integrations
PeopleSoft Simple Web Services (SWS)

Turn PeopleSoft data into clean REST APIs for AI integrations, modern applications, and vendor data feeds. Configuration-driven — no PeopleCode required.

  • Deploy production APIs in under 5 minutes
  • AI and LLM ready (RAG, chatbots, intelligent search)
  • JSON, XML, and CSV output
  • Zero modifications to delivered PeopleSoft objects