This wiki article is a tutorial from a recent presentation/demo I gave at the Alliance 2010 Down Under Conference in Brisbane.
It takes you through the following:
- Inspecting a web service using soapUI
- Consuming a web service in PeopleSoft using the consume web service wizard
- Creating a very simple pagelet with the pagelet wizard that uses the web service
Inspecting the Web Service
The web service we will be working with is a simple currency converter web service. The WSDL for this web service is available at
http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
First thing is to check this web service is available in your browser, so visit the URL above and check you see something similar to this:
A few things you might notice is that the web service uses currency codes for different currencies and these are defined in the WSDL. For example, AUD for Australia Dollars, NZD for New Zealand Dollars, USD for American Dollars and EUR for Euros.
Let's load the web service in soapUI and have a look at what it can do.
Start soapUI and create a new project. Fill in the following:
- Project name: Currency Converter
- Initial WSDL/WADL: http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
Leave the rests of the options at their defaults.
Once the project loads, expand out the project until you get to the Request:
Double click on the request to load the SOAP editor. This allows you to edit the XML (SOAP envelope and data) that will be sent to the web service. In particular take note of the question marks (?) which is where you need to supply data.
Change the From Currency to AUD and the To Currency to USD. This gives you the exchange rate from AUD$1 to USD$1. As you can see at time of writing AUD$1 is worth USD$1.0031.
Now that we know how to work with the web service, the next step is to consume the web service from PeopleSoft.
Consuming the Web Service
PeopleSoft provides a wizard for consuming web services as part of Integration Broker.
This wizard is available from:
PeopleTools > Integration Broker > Web Services > Consume Web Service
The first step in the wizard is to specify the WSDL:
Next, review the web service in step 2. You can click on the View WSDL hyperlink to view the WSDL in your browser as we did in the first part of this tutorial.
This web service has 4 service ports or variations of the web service. Select the first, CURRENCYCONVETORSOAP service port.
Next, you get to choose the service operation. There is only one in this case - ConversionRate.
Being a synchronous service, there are two messages - request and response. The next step creates these messages and optionally allows you to
rename them if necessary (note that you have skipped over step 5).
The final step is to select the receiver node, which by default will be WSDL_NODE.
Make sure you press Finish on this step to consume the web service.
This will give you a final screen that confirms the results and allows you to view your consumed web service:
Click on the View Consumed Service to open the service and see the IB definitions that have been created.
Creating a Pagelet to view your consumed web service
Now that we have consumed a web service, let's do something with it. In this case, I'm going to use the pagelet wizard to create a really
simple pagelet that displays the results of the web service based on user specified parameters.
Navigate to:
PeopleTools > Portal > Pagelet Wizard > Pagelet Wizard
To start the Pagelet Wizard. Add a new value with a Pagelet ID of CURRENCY_CONVERTER.
In step 1, specify some basic information about the pagelet:
In step 2, specify the data type as Integration Broker. Then fill in the service as CONVERSIONRATE and the receiver node name as WSDL_NODE.
In step 3, change the FromCurrency and ToCurrency field usage types from Fixed to User Specified. This means that when the pagelet is
enabled by the user, they can also set the From and To currency codes used by the pagelet to display the conversion rate.
Click on the Values links to set the From/To currency to the defaults you want to use (this will be a prompt):
In step 4, you specify the pagelet format. There is only one option in this case - custom format.
In step 5, you specify the pagelet display options which control how the pagelet is presented to the user. Select an XSL template of Table and press the generate button. Also set the opening text to Freeform/HTML and enter the HTML <strong>Conversion Result:</strong>.
In step 6, specify the pagelet as a homepage pagelet in the folder PeopleSoft Applications. Expand the Advanced Options and select the
Requires Personalization check box. Click finish or save to complete the wizard.
Enabling the Pagelet
To enable the pagelet, return to the PeopleSoft home page (home link on the navigation bar). Click on the Content link after the Personalize text above the main menu:
Select the check box for the currency converter pagelet under PeopleSoft Applications.
Press save, and this will take you back to the home page. Scroll down, and you should see the pagelet below your main menu.
As you can see, it will tell you that the pagelet requires customization - the from/to currency codes need to be specified. Click on the
Customize this pagelet hyperlink. Select your from/to currency codes, and save.
Once you return to the home page, you should now see the currency coverter in action.