Author Info
Chris Malek

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

About Chris Work with Chris
Do you need a quick way to create web services?
PeopleSoft Simple Web Services (SWS)

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

OnError - Non-REST

For the OnError Handler See REST Web Services - Generating and Working with Error Responses.

  throw CreateException( - 1, - 1, "you had an error mate!");
HTTP/1.1 200
status: 200
date: Sun, 29 Oct 2017 21:49:31 GMT
content-length: 373
content-type: text/xml; charset=UTF-8
transactionid: 0b74c7c1-bcf3-11e7-bc2c-e2a44ed419c0

<?xml version="1.0"?>
<IBResponse type="error">
  <DefaultTitle>Integration Broker Response</DefaultTitle>
  <DefaultMessage>you had an error mate! (-1,-1) CHG_IB_UTEST.syncUTest.OnExecute Name:onRequest PCPC:960 Statement:16</DefaultMessage>

OnError - REST

   %This.OnErrorHttpResponseCode = 404;
   throw CreateException( - 1, - 1, "you had an error mate!");
(REST based Service Only)
OnError Functionality
The Response Code and Content Type will be automatically set based
on the value defined for the Fault Message on the Service Operation Defintion.
These can be overrides by setting the property OnErrorHttpResponseCode and/or
the property OnErrorContentType

interface IRequestHandler
   method OnRequest(&message As Message) Returns Message;
   method OnError(&request As Message) Returns string;
   property integer OnErrorHttpResponseCode;
   property string OnErrorContentType;