0% found this document useful (0 votes)
11 views11 pages

Example To REST Provider Service

The document provides a comprehensive example of setting up a PeopleSoft REST provider service using GET and POST methods. It includes steps for creating message definitions, service definitions, and handler code, along with XML schema details for currency data. Additionally, it outlines testing procedures for the REST service operations.

Uploaded by

Yarime Valencia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views11 pages

Example To REST Provider Service

The document provides a comprehensive example of setting up a PeopleSoft REST provider service using GET and POST methods. It includes steps for creating message definitions, service definitions, and handler code, along with XML schema details for currency data. Additionally, it outlines testing procedures for the REST service operations.

Uploaded by

Yarime Valencia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Document Description Title:

E-IB: Example for PeopleSoft REST provider service (GET/POST methods) (Doc ID 1533318.1)

Example for PeopleSoft REST provider service (GET/POST methods)

1. Setup REST service target location

2. Create Document/Message definition (template and request/response messages)


1) Template message

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


1
2) Request/response message

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


2
NOTE: below is the exported schema for your reference

<?xml version="1.0"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/Enterprise/Tools/schemas/mypackage.currency.v1"
xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/mypackage.currency.v1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="currency" type="currency_TypeShape"/>
<xsd:complexType name="currency_TypeShape">
<xsd:sequence>
<xsd:element minOccurs="0" name="currency_cd" type="currency_cd_TypeDef"/>
<xsd:element minOccurs="0" name="effdt" type="effdt_TypeDef"/>
<xsd:element minOccurs="0" name="eff_status" type="eff_status_TypeDef"/>
<xsd:element minOccurs="0" name="desc" type="desc_TypeDef"/>
<xsd:element minOccurs="0" name="descshort" type="descshort_TypeDef"/>
<xsd:element minOccurs="0" name="country" type="country_TypeDef"/>
<xsd:element minOccurs="0" name="cur_symbol" type="cur_symbol_TypeDef"/>
<xsd:element minOccurs="0" name="decimal_positions" type="decimal_positions_TypeDef"/>
<xsd:element minOccurs="0" name="scale_positions" type="scale_positions_TypeDef"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="currency_cd_TypeDef">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="effdt_TypeDef">
<xsd:restriction base="xsd:date">
<xsd:pattern value="(\d{4}-\d{2}-\d{2})"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="eff_status_TypeDef">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="desc_TypeDef">

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


3
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="descshort_TypeDef">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="country_TypeDef">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="cur_symbol_TypeDef">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="decimal_positions_TypeDef">
<xsd:restriction base="xsd:integer">
<xsd:totalDigits value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="scale_positions_TypeDef">
<xsd:restriction base="xsd:integer">
<xsd:totalDigits value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

3. Create REST service definition

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


4
4. REST service operation definitions
1) GET method

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


5
2) POST method (request/response messages are optional)

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


6
5. REST provider service handler code for GET/POST method

import PS_PT:Integration:IRequestHandler;

class InboundSyncRequestHandler implements PS_PT:Integration:IRequestHandler


method InboundSyncRequestHandler();
method onRequest(&MSG As Message) Returns Message;
method onError(&MSG As Message) Returns string;
end-class;

method InboundSyncRequestHandler
end-method;

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


7
method onRequest
/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
Local Message &response;
Local Document &Doc_Tmpl, &Doc1;
Local Compound &COM1;
Local Record &rec1;
Local string &curr_cd;
Local SQL &SQL1;

/*****HTTP GET method************/


If &MSG.HTTPMethod = %IntBroker_HTTP_GET Then

/* read URI Document to get parms out */


&Doc_Tmpl = &MSG.GetURIDocument();
&curr_cd = &Doc_Tmpl.DocumentElement.GetPropertyByName("currency_cd").Value;

/*Create the response message */


&response = CreateMessage(Operation.CURRENCY_GET, %IntBroker_Response);
&Doc1 = &response.GetDocument();
&COM1 = &Doc1.DocumentElement;

/*** Create SQL object to retrieve the values from the rowset ***/
&rec1 = CreateRecord(Record.CURRENCY_CD_TBL);
&SQL1 = CreateSQL("%selectall(:1) where CURRENCY_CD = :2", &rec1, &curr_cd);
If &SQL1.Fetch(&rec1) Then
&COM1.GetPropertyByName("currency_cd").Value = &rec1.CURRENCY_CD.Value;
&COM1.GetPropertyByName("effdt").Value = &rec1.EFFDT.Value;
&COM1.GetPropertyByName("eff_status").Value = &rec1.EFF_STATUS.Value;
&COM1.GetPropertyByName("descr").Value = &rec1.DESCR.Value;
&COM1.GetPropertyByName("descrshort").Value = &rec1.DESCRSHORT.Value;
&COM1.GetPropertyByName("country").Value = &rec1.COUNTRY.Value;
&COM1.GetPropertyByName("cur_symbol").Value = &rec1.CUR_SYMBOL.Value;
&COM1.GetPropertyByName("decimal_positions").Value = &rec1.DECIMAL_POSITIONS.Value;
&COM1.GetPropertyByName("scale_positions").Value = &rec1.SCALE_POSITIONS.Value;
End-If;

End-If;

/*****HTTP POST method************/


If &MSG.HTTPMethod = %IntBroker_HTTP_POST Then
/* Get the document message */
&Doc1 = &MSG.GetDocument();
&COM1 = &Doc1.DocumentElement;

/* Create record and populate from document*/


&rec1 = CreateRecord(Record.CURRENCY_CD_TBL);
&rec1.GetField(Field.CURRENCY_CD).Value = &COM1.GetPropertyByName("currency_cd").Value;
&rec1.GetField(Field.EFFDT).Value = &COM1.GetPropertyByName("effdt").Value;
&rec1.GetField(Field.EFF_STATUS).Value = &COM1.GetPropertyByName("eff_status").Value;
&rec1.GetField(Field.DESCR).Value = &COM1.GetPropertyByName("descr").Value;
&rec1.GetField(Field.DESCRSHORT).Value = &COM1.GetPropertyByName("descrshort").Value;
&rec1.GetField(Field.COUNTRY).Value = &COM1.GetPropertyByName("country").Value;
&rec1.GetField(Field.CUR_SYMBOL).Value = &COM1.GetPropertyByName("cur_symbol").Value;
&rec1.GetField(Field.SCALE_POSITIONS).Value = &COM1.GetPropertyByName("decimal_positions").Value;
&rec1.GetField(Field.DECIMAL_POSITIONS).Value = &COM1.GetPropertyByName("scale_positions").Value;
&rec1.Update();

/*Create the response message */


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

End-If;

Return &response;

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


8
end-method;

method onError
/+ &MSG as Message +/
/+ Returns String +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnError +/
Local integer &nMsgNumber, &nMsgSetNumber;
Local string &str;
&nMsgNumber = &MSG.IBException.MessageNumber;
&nMsgSetNumber = &MSG.IBException.MessageSetNumber;
&str = &MSG.IBException.DefaultText;
Return &str;
end-method;

6. Test with sendmaster


1) REST get test

2) REST post test

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


9
NOTE: the xml contain the changes, e.g. DESCRSHORT=”TEST”
<?xml version="1.0"?>
<currency xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/mypackage.currency.v1">
<currency_cd>USD</currency_cd>
<effdt>1900-01-01</effdt>
<eff_status>A</eff_status>
<desc>US Dollar</desc>
<descshort>TEST</descshort>
<country>USA</country>
<cur_symbol>$</cur_symbol>
<decimal_positions>0</decimal_positions>
<scale_positions>2</scale_positions>
</currency>

Call Get method again to verify the change was done.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


10
7.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved.


11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy