Professional Documents
Culture Documents
PSIntegration With ASPapplication Guide PROVIDE WS
PSIntegration With ASPapplication Guide PROVIDE WS
PSIntegration With ASPapplication Guide PROVIDE WS
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.
ASP Page /
C# Code
End
User
ASP Application
Business
Rules
PS
Database
PeopleSoft
Component Interface
PeopleSoft System
-4-
-5-
-6-
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 13. Above is a screenshot showing how to provide access to the web
services that you want to expose.
- 11 -
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 -
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 -
- 16 -
7. Appendix
7.1 The software configuration used for setting up the
Demo
1.
2.
3.
4.
5.
CodeFile="Default.aspx.cs"
- 17 -
- 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;
- 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();
}
}
- 22 -