You are on page 1of 22

INTEGRATION OF PEOPLESOFT WITH A THIRD PARTY APPLICATION USING COMPONENT INTERFACE BASED WEB SERVICES.

PeopleSoft here, being the web service provider and a simple ASP application being the consumer of the web service.

Siddarth Pavanje Rajendra Pai

-1-

TABLE OF CONTENTS
1. INTRODUCTION ........................................................................................................................... 3 2. PURPOSE ........................................................................................................................................ 4 3. HOW TO PROVIDE A COMPONENT INTERFACE WEB SERVICE FROM PEOPLESOFT ..................................................................................................................................... 5 4. HOW TO CONSUME THIS WEB SERVICE IN YOUR ASP APPLICATION. ......... 12 5. THE INTEGRATION IN THE WORKS! .............................................................................. 14 6. SUMMARY AND BENEFITS .................................................................................................. 16 7. APPENDIX .................................................................................................................................... 17 7.1 THE SOFTWARE CONFIGURATION USED FOR SETTING UP THE DEMO.......................................... 17 7.2 THE ASP CODE TO CONSUME THE WEB SERVICE PROVIDED BY PEOPLESOFT ............................ 17

-2-

1. Introduction
Why would you prefer assembling your computer over buying a completely built unit? Simple! You want the flexibility to be able to choose what components go into your computer assembly. Probably you want some of the components to be the best in their category and would not want to compromise on its quality or would simply, want them from a certain brand. Or probably, you do not find use for all the components in a completely built unit and would want to forego some of the components, to save on the overall cost. These are a few of the reasons as to why someone would prefer an assembled computer over a completely built unit. Flexibility and scalability! In a similar way, enterprise solutions are now moving in a whole new direction. Towards something called a Service Oriented Architecture, popularly known as SOA. Much like assembling your computer, a Service Oriented Architecture gives you the flexibility to choose your components and once you have done that, you simply have to plug and play it! This is unlike the older generations of enterprise solutions, when it was required that most of the components be bought from the same vendor to make them compatible with the other components which were bought from this vendor. In a way, this led to monopoly, by Enterprise Software providers and the consumer had very little option but to either go for a product from either vendor A or vendor B. None of the components of these products were interchangeable. With the advent of SOA, this monopoly was broken and the consumer now, has much more options to choose from! This integration of one application with another provided the platform for faster, independent and much better business processes in the enterprise. While the HR department maintained employee records, the payroll team would be busy calculating the taxes to be paid by the employees, similarly, the inventory team would keep track of goods coming in/going out and the finance team would keep track of the overall budget of the company! This way, though the work done by each of the teams was dependent on each other, it was streamlined in such a way that they appeared to be independent. This is what SOA aims to achieve and in this whitepaper, we will discuss one such integration of a PeopleSoft application with a .NET application. We will use web services, and specifically, CI based web services in PeopleSoft, due to its inherent advantages (to be discussed later) and ease of use! Also, web services are the way to go in this generation of the internet and World Wide Web, where it is expected that the service has to be platform independent and robust. Further, lets see the working of the integration, and how it was achieved. And after that, we will discuss the advantages and the disadvantages of implementing such architecture.

-3-

2. Purpose
We will try to open up PeopleSoft to another application using a web service. The other application must be able to insert or fetch data from PeopleSoft tables, with all the PeopleSoft validations firing on the data appropriately. If we can achieve this, then it would mean that all business validations are written in PeopleSoft and the external application is just referring to this business logic without having to validate data on its own. A Web Service is defined by the W3C as "a software system designed to support interoperable machine-to-machine interaction over a network" In our example, which will follow, we will make use of the location setup page in PeopleSoft. We will build a similar ASP page and try to see if we can enter data on the ASP page and save it into PeopleSoft tables via a component interface. Hence, in theory, we would not have to write any validations to validate data on the ASP side. All validations that should fire are the ones that are on the PeopleSoft side. Hence, the ASP application is just an interface between the user and the PeopleSoft system. Business Rules

Web Services interface. pro

End User

ASP Page / C# Code

PS Database

ASP Application

PeopleSoft Component Interface PeopleSoft System

Figure 1. An overview of the components involved in the integration. As seen in the diagram above, the PeopleSoft system is abstracted to the end user. He only deals with the ASP application. Data moving into and outside of the PeopleSoft system is restricted by appropriate component and row security in PeopleSoft. Also, considering the PeopleSoft system as a node, we will be able to authenticate third party systems trying to communicate with PeopleSoft using a username/password type of authentication. All of these authentication mechanisms are hidden from the user and are taken care of internally, by the ASP code which is trying to communicate with PeopleSoft.

-4-

3. How to provide a Component Interface web service from PeopleSoft


What we have to understand here is that in this scenario, PeopleSoft becomes a service provider and the ASP application becomes the consumer of the web service provided by PeopleSoft. To start with, lets divide the Web Services setup in PeopleSoft, into different steps. 1. PeopleSoft Integration Broker Setup. 2. Exposing a Component Interface as a web service. 3. Security Configuration for the component and the web service. Now, lets look each of the steps in more detail. 1. PeopleSoft Integration Broker Setup Most integration broker setup configurations are the default ones that apply to all integrations involving a third party application. In our case we would be using the default HRMS node PSFT_HR. Make sure this is appended in the Target location URL of the Service Configuration.

Figure 2. An overview of the components involved in the integration.

-5-

Figure 3. Node Authentication setup.

Figure 4. Target connectors. As shown in the above screenshots, make sure you have provided appropriate security authentications. Also make sure you choose the correct connector. In our case, we have chosen PSFTTARGET as our connector. Also, PeopleSoft uses a node called Anonymous, internally. Make sure you provide the correct authentication to this node; lest you might end up with an authentication error after the WSDL (web service) is published.

-6-

2. Exposing a Component Interface as a web service CI based web services can be provided in PeopleTools 8.48 onwards, under the navigation PeopleTools > Integration Broker > Web Services > CI Based web services.

Figure 5. Select your Component Interface to expose to the ASP Application.

Figure 6. Select the methods of the CI which you want to expose. The option to select, are greyed out because the methods are already implemented.

-7-

Figure 7. View your Service Definition and related Service Operations (Each method is exposed as a Service operation).

Figure 8. Provide the web service by selecting the service operations that you want to publish.

-8-

Figure 9. Publish the generated WSDL file either to the WSDL repository or to one or more UDDI servers. In our example we will publish it to the WSDL repository.

Figure 10. PeopleSoft generates a URL for the file, copy this URL and paste it into the browser. You must be able to view the WSDL file. In case you are not able to view the WSDL file, kindly refer to Oracle Metalink for possible resolution and trouble shooting tips.

-9-

Figure 11. This is how the WSDL file looks like, when opened with a browser like Internet Explorer. 3. Security configuration for the component and the Web Service. Make sure atleast one of the permission list attached to the any one of the roles you have, gives you access to the component, as well as the web service. Remember that service operations can be configured separately. Also make sure that you have provided access to the IBUTILITY web service and its respective service operations. This is because PeopleSoft uses this service internally and you would require permission to this Web Service in order to perform operations like GETSCHEMA, GETWSDL, GETROUTINGS etc.

- 10 -

Figure 12. Above is a screenshot of how to provide access to the Component Interfaces that you want to expose.

Figure 13. Above is a screenshot showing how to provide access to the web services that you want to expose.

- 11 -

4. How to consume this web service in your ASP application.


The screenshots are pretty much self explanatory. We create a new ASP project with a form and a few text boxes so that it resembles the PeopleSoft Location Setup page.

Figure 14. Open Visual Studio and create a new ASP.NET website.

- 12 -

Figure 15. Add a web reference and point it to the URL of the WSDL generated by PeopleSoft.

Figure 16. When the web reference is imported, you will be able to see the methods that were exposed in PeopleSoft, as methods. Now, use these methods to fetch or insert data into PeopleSoft. For the complete ASP code, kindly refer the appendix.

- 13 -

5. The integration in the works!


Lets see how our integration works. Go to the default URL of your ASP application. You will be able to see something like this:

Figure 17. Using the Get method - When you click on Fetch Data, then the description, effective date, status and Address of the location 55555 are fetched from the database. In our example, we have hard coded the value of the location in our default.aspx and the location 55555 already exists in the location table PS_LOCATION_TBL.

Figure 18. Using the Create method. When you click on Insert Data, then the default values of on the Component are saved to the database. Depending on the status returned by the method, we are displaying the error message. Now, just to prove our concept that all the validations that fire in PeopleSoft can be handled or captured in the ASP application, lets write a PeopleCode error message on the SaveEdit event of the LOCATION_TBL component.

- 14 -

Figure 19. We write an error message just to prove that we can capture this in the ASP application.

Figure 20. The error message that we had written in the earlier step is captured in the ASP application.

- 15 -

6. Summary and Benefits


Web services provide several technological and business benefits, some of the key ones include: Application and data integration along with the maintenance of data sanctity Versatility and scalability Re-usability Reduction in cost of operation Using web-services there is flexibility for any application interacting with any other application which is due to platform, language independent XML technologies along with HTTP being used for communication between applications. The client only requires the WSDL definition to effectively exchange data with the service and neither part needs to know how the other is implemented or in what format its underlying data is stored. These benefits allow organizations to integrate disparate applications and data formats with relative ease. Web services are also versatile by design. They can be accessed by humans via a Web-based client interface, or they can be accessed by other applications and other Web services. A client can even combine data from multiple Web services to, for instance, present a user with an application to update sales, shipping, and ERP systems from one unified interface even if the systems themselves are incompatible. Because the systems exchange information via Web services, a change to the sales database, for example, will not affect the service itself. Code re-use is another positive side-effect of Web services' interoperability and flexibility. One service might be utilized by several clients, all of which employ the operations provided to fulfil different business objectives. Instead of having to create a custom service for each unique requirement, portions of a service are simply re-used as necessary. All these benefits add up to significant cost savings. Easy interoperability means the need to create highly customized applications for integrating data, which can be expensive, is removed. Existing investments in systems development and infrastructure can be utilized easily and combined to add additional value. Since Web services are based on open standards their cost is low and the associated learning curve is smaller than that of many proprietary solutions. Finally, Web services take advantage of ubiquitous protocols and the Web infrastructure that already exists in every organization, so they require little if any additional technology investment.

- 16 -

7. Appendix
7.1 The software configuration used for setting up the Demo
1. 2. 3. 4. 5. PeopleTools 8.48.08 with PeopleSoft HCM 9.0 and a demo database. Visual Studio 2005 Microsoft SQL Server 2005 Microsoft Internet Information Services server All this was setup on a Microsoft Windows XP platform and since all of these were setup on a single machine, to resolve any port conflicts between BEA Weblogic server (Port 80) and IIS Server (Port 7002), both were configured to work on different ports.

7.2 The ASP code to consume the web service provided by PeopleSoft
The code for your default.aspx page This is the code that renders the frontend of your ASP application. --- BEGINNING of default.aspx.cs
<%@ Page Language="C#" AutoEventWireup="true" Inherits="_Default" %> CodeFile="Default.aspx.cs"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Create a new location in PeopleSoft</title> <script language="javascript" type="text/javascript"> </script> </head> <body> <form id="form2" runat="server"> <div> <table border="0px" cellpadding = "4px" cellspacing = "4px" style="width: 935px; height: 222px" id="TABLE1" onclick="return TABLE1_onclick()"> <tr><td colspan="2"> <strong><span style="text-decoration: underline; background-color: gold;">Fetch the details of an already existing &nbsp;location in PeopleSoft_______________________________________________________________</span></stro ng></td></tr> <tr> <td align="left" style="width: 37px"> <strong>SETID</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="SETID1" runat="server" Width="380px" Text = "SHARE" ReadOnly = "true" BackColor="#E0E0E0"></asp:TextBox></td> </tr> <tr> <td align="left" style="width: 37px"> <strong>LOCATION</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="LOCATION1" runat="server" Width="380px" Text = "55555" BackColor="#E0E0E0"></asp:TextBox></td> </tr> <tr>

- 17 -

<td style="width: 37px" rowspan="2"></td><td align = "center" style="width: 147px"><asp:Button ID="SUBMIT1" runat="server" OnClick="Button2_Click" Text="Fetch Data" /></td> </tr> <tr> <td align="left" style="height: 27px"> <strong><span style="text-decoration: underline">VALUES FETCHED BY THE GET METHOD FROM PEOPLESOFT</span></strong></td> </tr> <tr> <td align="left" style="width: 37px; height: 34px;"> <strong>DESCRIPTION</strong></td><td align="left" style="width: 164px; height: 34px;"><asp:TextBox ID="DESCRIPTION1" runat="server" Width="380px" ReadOnly = "true" style="font-style: italic"></asp:TextBox></td> </tr> <tr> <td align="left" style="width: 37px"> <strong>EFFDT</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="EFFDT1" runat="server" Width="380px" ReadOnly = "true" style="font-style: italic"></asp:TextBox></td> </tr> <tr> <td align="left" style="width: 37px"> <strong>STATUS</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="STATUS1" runat="server" Width="380px" ReadOnly = "true" style="font-style: italic"></asp:TextBox></td> </tr> <tr> <td align="left" style="width: 37px"> <strong>ADDRESS</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="ADDRESS1" runat="server" Width="790px" ReadOnly = "true" Height="51px" style="font-style: italic" ></asp:TextBox></td> </tr> <tr><td style="height: 27px" colspan="2"> <strong><span style="text-decoration: underline; background-color: gold;">Create a new location in PeopleSoft____________________________________________________________________________ ________</span></strong></td></tr> <tr> <td align="left" style="width: 147px"> <strong>SETID</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="SETID" runat="server" ForeColor="Black" Width="380px" ></asp:TextBox></td> </tr> <tr> <td align="left" style="width: 147px"> <strong>LOCATION</strong></td><td align="left" style="width: 164px"><asp:TextBox ID="LOCATION" runat="server" Width="380px" ></asp:TextBox></td> </tr> <tr> <td rowspan="3"></td><td align = "center" style="width: 147px"><asp:Button ID="SUBMIT" runat="server" OnClick="Button1_Click" Text="Insert Data" /></td> </tr> <tr> <td align="left" style="height: 27px"> <strong><span style="text-decoration: underline">RESPONSE FROM PEOPLESOFT</span></strong></td> </tr> <tr> <td align="left"><asp:TextBox ID="RESPONSE" runat="server" Height="69px" Width="750px" ReadOnly = "true" style="background-color: #E0E0E0; font-style: italic;" TextMode="MultiLine" BackColor="#E0E0E0"></asp:TextBox></td> </tr> </table> </div> </form> </body> </html>

--- END of default.aspx Below is the code for your default.aspx.cs This is what takes care of your processing and this is where the methods exposed by the web service are

- 18 -

called. In the example code below, we are implementing only the create and the get method of LOCATION Component Interface. --- BEGINNING of default.aspx.cs
using using using using using using using using using using using using using using System; System.Data; System.Configuration; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; LocationWebService; System.Web.Services; System.Web.Handlers; System.Xml; System.Web.Services.Protocols;

public partial class _Default : System.Web.UI.Page { private System.ComponentModel.BackgroundWorker backgroundWorker1; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { /*Clear all Get Method Demo textboxes*/ DESCRIPTION1.Text = ""; EFFDT1.Text = ""; STATUS1.Text = ""; ADDRESS1.Text = ""; /*Sid test*/ CI_LOCATION LocationSrvc = new CI_LOCATION(); /*Create the request object.*/ Create__CompIntfc__LOCATIONTypeShape LocationRqst = new Create__CompIntfc__LOCATIONTypeShape(); /*Create Country, Description objects*/ SETIDTypeShape Setid = new SETIDTypeShape(); LOCATIONTypeShape Location = new LOCATIONTypeShape(); /*Assign the values from the page to the objects*/ Setid.Value = SETID.Text; Location.Value = LOCATION.Text; /*Assign each object to the request object*/ LocationRqst.SETID = Setid; LocationRqst.LOCATION = Location; /*Create Response object*/ Create__CompIntfc__LOCATIONResponseTypeShape LocationResp = new Create__CompIntfc__LOCATIONResponseTypeShape();

- 19 -

/*call the web service.Notice the name of the method called.This is name of alias we provided in PeopleSoft*/ try { LocationResp = LocationSrvc.CI_LOCATION_C(LocationRqst); RESPONSE.Text = "SUCCESS: " + "The Location " + Location.Value +" was successfully inserted into PeopleSoft tables."; //RESPONSE.Text = LocationResp.detail.ToString(); } catch (Exception ex) { //Traverse through the SOAP Message //Read the StatusCode and the MessageID //Display the Error Text message for that particular MessageID //RESPONSE.Text = "<<Error Text>>"; //RESPONSE.Text = ex.Message; string strSoapPart = ex.Message.Substring(ex.Message.IndexOf('<'), (ex.Message.LastIndexOf('>') - ex.Message.IndexOf('<')) + 1); //string strSoapPart = ex.Message.Substring(125, 852); XmlDocument doc = new XmlDocument(); XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(doc.NameTable); xmlnsManager.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); doc.LoadXml(strSoapPart); //create a XML Node and traverse through the node to get the MessageID value XmlNode xmlMessageIDNode = doc.SelectSingleNode("SOAP-ENV:Envelope/SOAPENV:Body/SOAP-ENV:Fault/detail/IBResponse/MessageID", xmlnsManager); XmlNode xmlMessageNode = doc.SelectSingleNode("SOAP-ENV:Envelope/SOAPENV:Body/SOAP-ENV:Fault/detail/IBResponse/DefaultMessage", xmlnsManager); string Value = xmlMessageIDNode.InnerText; string Message = xmlMessageNode.InnerText; switch (Value) { case "49": RESPONSE.Text = ("This SetID \" " + Setid.Value + " \" and the location \" " + Location.Value + " \" already exists" ); break; case "54": RESPONSE.Text = ("Cannot insert null values!"); break; default: //RESPONSE.Text = ("Unknown Error!"); RESPONSE.Text = Message; break; } } } protected void Button2_Click(object sender, EventArgs e) { /*Clear textboxes*/ SETID.Text = ""; LOCATION.Text = ""; RESPONSE.Text = ""; /*Sid test*/ CI_LOCATION LocationSrvc = new CI_LOCATION(); /*Create the request object.*/ Get__CompIntfc__LOCATIONTypeShape LocationGetRqst = new Get__CompIntfc__LOCATIONTypeShape(); /*Create Country, Description objects*/ SETIDTypeShape Setid = new

- 20 -

SETIDTypeShape(); LOCATIONTypeShape Location = new LOCATIONTypeShape(); LOCATION_TBLTypeShape1[] LocationTable; /*Assign the values from the page to the objects*/ Setid.Value = SETID1.Text; Location.Value = LOCATION1.Text; /*Assign each object to the request object*/ LocationGetRqst.SETID = new SETIDTypeShape4(); LocationGetRqst.LOCATION = new LOCATIONTypeShape4(); LocationGetRqst.SETID.Value = Setid.Value; LocationGetRqst.LOCATION.Value = Location.Value; try { LocationTable = LocationSrvc.CI_LOCATION_G(LocationGetRqst); //RESPONSE.Text = LocationTable[0].EFFDT.Value.ToString(); DESCRIPTION1.Text = LocationTable[0].DESCR_0.Value.ToString(); EFFDT1.Text = LocationTable[0].EFFDT.Value.ToString(); STATUS1.Text = LocationTable[0].EFF_STATUS.Value.ToString(); ADDRESS1.Text = LocationTable[0].ADDRESS1.Value.ToString(); } catch (Exception ex) { //Traverse through the SOAP Message //Read the StatusCode and the MessageID //Display the Error Text message for that particular MessageID //RESPONSE.Text = "<<Error Text>>"; //string strSoapPart = ex.Message.Substring(ex.Message.IndexOf('<'), (ex.Message.LastIndexOf('>') - ex.Message.IndexOf('<')) + 1); ////string strSoapPart = ex.Message.Substring(125, 852); //XmlDocument doc = new XmlDocument(); //XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(doc.NameTable); //xmlnsManager.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); //doc.LoadXml(strSoapPart); ////create a XML Node and traverse through the node to get the MessageID value ////XmlNode xmlNode = doc.SelectSingleNode("SOAP-ENV:Envelope/SOAPENV:Body/SOAP-ENV:Fault/detail/IBResponse/MessageID", xmlnsManager); //XmlNode xmlNode = doc.SelectSingleNode("SOAP-ENV:Envelope/SOAPENV:Body/SOAP-ENV:Fault/detail/IBResponse/DefaultMessage", xmlnsManager); //string value = xmlNode.InnerText; // switch (value) // { // case "49": // RESPONSE.Text = ("This SetID \" " + Setid.Value + " \" and the location \" " + Location.Value + " \" already exists" ); // break; // case "54": // RESPONSE.Text = ("Cannot insert null values!"); // break; // default: // //RESPONSE.Text = ("Unknown Error!"); // RESPONSE.Text = value; // break; // } // } // // RESPONSE.Text = CountryResp.notification.Value.ToString();

- 21 -

//// if (LocationResp.notification.Value.Equals(1)) RESPONSE.Text = ex.Message; } } private void InitializeComponent() { this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); } }

--- END of default.aspx.cs

- 22 -

You might also like