Contents
Contents

Python HTTP Post Examples

Struggling to bridge the legacy gap? Cedar Hills Group provides specialized PeopleSoft integration consulting to help teams design, build, and optimize their connection strategies.

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 Profile
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with over two decades of experience. He is available for consulting engagements.

Work with Chris
Subscribe to Updates
SWS Bolt-On
PeopleSoft Simple Web Services

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
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

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
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

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
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

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
Read More & Purchase
psLens Platform
psLens Operations & Intelligence

Look up any record, field, page, or component, audit security, and monitor Integration Broker across every database — in seconds.

  • 30+ object types browsable
  • 16 real-time alert types
  • Read-only by design
  • No App Designer or SQL required
Learn More
psLens Platform
psLens Operations & Intelligence

A web console built for the PeopleSoft community — operational monitoring, security auditing, and metadata browsing in one tool.

  • Sub-second object search
  • Catch stuck IB messages before users do
  • Audit service permissions from one screen
  • Works in any browser
Learn More
psLens Platform
psLens Operations & Intelligence

On-demand security and operational reports for your PeopleSoft environment — no client install required.

  • 14 on-demand reports
  • Markdown export for AI/LLM workflows
  • No shared tenancy
  • Built on 25+ years of PeopleSoft expertise
Learn More
psLens Platform
psLens Operations & Intelligence

Research any PeopleSoft object and monitor system health from a single browser tab — no App Designer, no SQL.

  • 30+ PeopleSoft object types browsable
  • Real-time alerts before users report problems
  • Read-only and secure
  • Private alpha — early access now
Learn More