Contents
Contents

PsoftToXML Application Class

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

The psoftToXML Application Class converts PeopleSoft objects (Rowsets, Rows, Records) to XML for use in web services. It serves as an alternative to Rowset-based messages, providing more flexibility in organizing the output while still leveraging standard PeopleSoft data objects.

Why Use This?

When providing XML web services from PeopleSoft, your encoding options are:

  • PeopleCode XML class - Create bespoke XML documents manually. Required when clients need a specific XML structure.
  • Rowset-based messages - Let PeopleSoft handle the encoding. The XML structure is tightly coupled to the record structures.
  • psoftToXML - A middle ground that encodes PeopleSoft objects to XML dynamically, with some flexibility over what gets included.

The psoftToXML class is useful when:

  • You are providing raw PeopleSoft data to a 3rd party that can handle the PeopleSoft data structure
  • You want to avoid maintaining a bunch of Rowset-based messages every time you add a new table to an export
  • You need dynamic content where a Rowset-based message is tied to a specific record

Class Signature

class psoftToXML
   method RowsetToXML(&parentNode As XmlNode, &rowSetIn As Rowset) Returns XmlNode;
   method RecordToXML(&parentNode As XmlNode, &recordIn As Record) Returns XmlNode;
   method FieldToXML(&ParentNode As XmlNode, &fieldIn As Field) Returns XmlNode;
   method RowToXML(&ParentNode As XmlNode, &rowIn As Row) Returns XmlNode;
   method psoftToXML();
   property array of string fieldsToSkip;
end-class;

Import: import CHG_XML:psoftToXML;

Example 1 - Return Person Rowset

Encode a rowset with the PERSON record for one person:

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

Local CHG_XML:psoftToXML &p2XML = create CHG_XML:psoftToXML();

Local XmlDoc &xmlout;
Local XmlNode &childNode;

&xmlout = CreateXmlDoc("<?xml version='1.0'?><response/>");

Local Rowset &rsPerson = CreateRowset(Record.PERSON);

&rsPerson.Fill("WHERE EMPLID = :1 ", &paramEMPLID);
&childNode = &p2XML.RowsetToXML(&xmlout.DocumentElement, &rsPerson);

&response.SetXmlDoc(&xmlout);

Output:

<?xml version="1.0"?>
<response>
    <PERSON PSOBJECTTYPE="ROWSET">
        <ROW PSOBJECTTYPE="ROW" RowNumber="1">
            <PERSON PSOBJECTTYPE="RECORD">
                <EMPLID PSFIELDTYPE="CHAR" PSOBJECTTYPE="FIELD">L00013</EMPLID>
                <BIRTHDATE PSFIELDTYPE="DATE" PSOBJECTTYPE="FIELD">1950-04-01</BIRTHDATE>
                <BIRTHCOUNTRY PSFIELDTYPE="CHAR" PSOBJECTTYPE="FIELD">USA</BIRTHCOUNTRY>
                <LAST_CHILD_UPDDTM PSFIELDTYPE="DATETIME" PSOBJECTTYPE="FIELD">2009-04-14-10.26.08.000000</LAST_CHILD_UPDDTM>
            </PERSON>
        </ROW>
    </PERSON>
</response>

Example 2 - Encode a Single Record

You can also encode just one record object:

Local Record &recPerson = CreateRecord(Record.PERSON);
&recPerson.EMPLID.Value = &paramEMPLID;
&recPerson.SelectByKey();

&childNode = &p2XML.RecordToXML(&xmlout.DocumentElement, &recPerson);

Example 3 - Nested Rowsets

The RowsetToXML method recursively encodes child rowsets. In this example, we create a PERSON -> ADDRESSES hierarchy:

Local Rowset &rsPerson2 = CreateRowset(Record.PERSON, CreateRowset(Record.ADDRESSES));
&rsPerson2.Fill("WHERE EMPLID = :1 ", &paramEMPLID);
&rsPerson2.GetRow(1).GetRowset(Scroll.ADDRESSES).Fill("WHERE EMPLID = :1 ", &paramEMPLID);

&childNode = &p2XML.RowsetToXML(&xmlout.DocumentElement, &rsPerson2);

This produces nested XML with the PERSON record and all ADDRESS rows as child elements.

Example 4 - Excluding Fields

You can exclude fields by pushing field names to the fieldsToSkip array. This is useful for fields that are sensitive or you don’t want to expose to a client:

&p2XML.fieldsToSkip.Push("DT_OF_DEATH");
&p2XML.fieldsToSkip.Push("BIRTHDATE");

Local Record &recPerson4 = CreateRecord(Record.PERSON);
&recPerson4.EMPLID.Value = &paramEMPLID;
&recPerson4.SelectByKey();
&childNode = &p2XML.RecordToXML(&xmlout.DocumentElement, &recPerson4);

The excluded fields will not appear in the output.

Example 5 - Custom XML Structure

All encoding methods take an XML parent node as a parameter, so you can organize the output under different XML elements:

Local Record &recPerson5 = CreateRecord(Record.PERSON);
&recPerson5.EMPLID.Value = &paramEMPLID;
&recPerson5.SelectByKey();

Local XmlNode &tempNode;

&tempNode = &xmlout.DocumentElement.AddElement("PERSON_DATA");
&childNode = &p2XML.RecordToXML(&tempNode, &recPerson5);

&tempNode = &xmlout.DocumentElement.AddElement("SECURITY_DATA");
Local Record &recOPR5 = CreateRecord(Record.PSOPRDEFN);
SQLExec("%selectall(:1) WHERE PSOPRDEFN.EMPLID = :2", &recOPR5, &paramEMPLID, &recOPR5);
&childNode = &p2XML.RecordToXML(&tempNode, &recOPR5);

This produces XML with PERSON_DATA and SECURITY_DATA as separate parent sections.

Getting the Code

The PeopleSoft project is available on GitHub: psoftToXML

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