User Tools

Site Tools


tech:psoft:peoplesoft_soap_example

Using PeopleSoft SOAP Classes

Overview

There are a number of ways to implement SOAP transactions in PeopleSoft. Here we are demonstrating the use of simple PeopleSoft SOAP classes. The goal of this exercise is for some third party system to send an OPRID and a SSN to our system, we will respond with a true or false message depending on whether the SSN is actually valid.
N.B. SSN's are not meant to be transmitted in the open so your SOAP gateway should always be protected via SSL or tcprules or something to that effect.

The SOAP Message

The client will post a message to the PeopleSoft Integration Gateway. The two parameters that our SOAP service receives are “OPRID” and “SSN”. In the message below, the third party client is trying to verify that OPRID = “bob_smith” actually has the SSN = “999999999”:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
     <ValidateSSN>
        <OPRID>bob_smith</OPRID>
        <SSN>999999999</SSN>
     </ValidateSSN>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The Return Message

“OnRequest” PeopleCode will fire, parse the request XML and will return a response that looks like:

tbd

Implementation

  1. Create a Message Definition called NX_VALIDATE_SSN, assign it to the appropriate Message Channel and verify that the Message and the Channel are active.
  2. Do not create any Subscription PeopleCode. Click on the message and select “View PeopleCode”.
  3. Insert the following PeopleCode into the “OnRequest” PeopleCode type.

The PeopleCode

The PeopleCode below, parses out the request message, uses the “SQLExec” statement to verify that the SSN is accurate, and returns and XML response to the caller.

/*********************************************/
/* CUST399 - 02/25/2005 - Ayush Zutshi       */
/* Provide SSN Validation to 3rd party via   */
/* SOAP Web Service                          */
/*********************************************/
Local XmlDoc &request, &response;
Local string &ssn, &result, &req_oprid, &req_ssn;
Local boolean &error;
Local SOAPDoc &soapReq, &soapRes;

/* Process the request() */
&request = GetMessageXmlDoc();
&soapReq = CreateSOAPDoc();
&soapReq.XmlDoc = &request;
&OK = &soapReq.ValidateSOAPDoc();
&req_oprid = &soapReq.GetParmValue(1);
&req_ssn = &soapReq.GetParmValue(2);

/* Validate the SSN */
SQLExec("select S.NATIONAL_ID from PSOPRDEFN O, PS_PERS_NID S 
where O.OPRID = :1 and O.EMPLID = S.EMPLID 
and S.NATIONAL_ID_TYPE= 'PR'", &req_oprid, &ssn);
If &ssn = &req_ssn Then
   &result = "True";
Else
   &result = "False"
End-If;

/* Assemble the Response */
&soapRes = CreateSOAPDoc();
&soapRes.AddMethod("ValidateSSN", 0);
&soapRes.AddParm("Result", &result);
&OK = &soapRes.ValidateSOAPDoc();

/* Return the Response */
&response = &soapRes.XmlDoc;
ReturnToServer(&response);

Testing with Sendmaster

  • Use project type INPUT FILE
  • Use the HTTP Listening Connector
  • Use the text below for the headers:
    Content-type: text/xml; charset=UTF8
    SOAPAction:#NX_VALIDATE_SSN#PSFT_HR#<password>#PSFT_HR
    
  • Use the following for your PeopleSoft Gateway
    http://[email protected]:7050/PSIGW/HttpListeningConnector
    
tech/psoft/peoplesoft_soap_example.txt · Last modified: 2024/06/21 12:04 by 127.0.0.1