...

Creating and Consuming Web Services using IBM Rational Business

by user

on
Category: Documents
25

views

Report

Comments

Transcript

Creating and Consuming Web Services using IBM Rational Business
EGL Web Services 1 of 48
Creating and Consuming Web Services using IBM Rational Business
Developer Enterprise Generation Language (EGL)
By Claus Weiss
Advisory Software Consultant
IBM Corporation
Skill Level: Intermediate
April 2010
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 2 of 48
Introduction..................................................................................................................................... 3
Section 1. Before you start.............................................................................................................. 3
Using Web Services in EGL ........................................................................................................... 5
The finished applications will contain the following web pages and capabilities...................... 5
Section 1 – Creating EGL Web Services........................................................................................ 7
Creating the application .............................................................................................................. 7
Create an EGL web project....................................................................................................... 10
Section 2 – Consuming a 3rd Party Web Service ......................................................................... 25
Find the Service ........................................................................................................................ 25
Create a new EGL Web project ................................................................................................ 26
Create Interface for web service ............................................................................................... 30
Create a Web Page Using the Service....................................................................................... 32
Test the application ................................................................................................................... 43
Summary ....................................................................................................................................... 46
Resources ...................................................................................................................................... 46
About the authors.......................................................................................................................... 47
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 3 of 48
Introduction
0B
The tutorial provides hands-on experience using the IBM® Rational® Developer for i™ for
SOA Construction workbench with IBM® Rational® Business Developer. It shows how easy it
is to use Web services in EGL, regardless of whether they are created in EGL as a Service or
used in EGL applications.
Section 1. Before you start
1B
Important Note: Walk through this scenario and others online as part of the
Enterprise Modernization Sandbox for IBM i™. You can also print out the scenario – see pdf
files on the right.
About this tutorial
In this tutorial, you will:
• Create an EGL application that will be used as a Web service, and to use
an existing Web service in an EGL application.
• Learn to use IBM® Rational® Business Developer to build, test, and
consume Web Services.
Objectives:
You will learn how to:
• Create an EGL project
• Create and Test EGL Web services
• Consume a third-party Web service
Prerequisites:
You should be familiar with one of the IBM® Rational® Software Delivery Platform
products that Rational Business Developer supports, and have knowledge of IBM®
IBM i™ applications.
System requirements:
Operating Systems:
Microsoft® Windows® 2000 SP4, Windows 2003 Enterprise SP1, Windows 2003
Standard SP1, Windows XP Professional SP2, Windows Vista Business, Windows
Vista Enterprise, Windows Vista Ultimate
Hardware:
Intel® Pentium® III 800 MHz processor minimum (higher is recommended) 1 GB
RAM; 1.5 GB RAM recommended
Minimum: 800 MB of disk space is required for product package installation.
Additional disk space is required for the resources that you develop.
Overall tutorial guide
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 4 of 48
The objective of this EGL scenario is for you to work with an EGL application that will be used as a Service and to use an existing Web Service in an EGL application. The scenario is intended to allow hands
on experience using the RDI SOA workbench with Rational Business Developer. It shows how easy it is
to use Web Services in EGL regardless whether they are created in EGL as a Service or used in EGL applications.
The first exercise creates an EGL application that can then be used as a Web Service. The second exercise
uses an existing Web Service showing movies playing in US theaters and creates an EGL application that
displays the data delivered from this Web Service.
It is assumed that you are familiar with basic Windows UI operations such as working with the desktop
and basic mouse operations such as opening folders and performing drag-and-drop operations.
Experience with an Eclipse based workbench like WebSphere Development Studio Client (WDSC), Rational Developer for System i (RDI), or Rational Application Developer (RAD) is an asset but is not necessary.
Note: The pictures in these labs show a similar application being built. Some of the names and icons may
be different than the environment you are working with.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 5 of 48
Using Web Services in EGL
This document provides basic procedures for creating and consuming web Services in EGL
The finished applications will contain the following web pages and capabilities
7B
In the first section of this Lab, you will create an EGL web service and then test the service using the Web Service Explorer. The service will check for valid California zip codes.
Using the Web Service Explorer you will generate a very simple UI for testing the service. It
contains one input field to enter the zip code and will show a return code of 0 or -1 determined
by your EGL service depending whether the zip code is a valid California code.
Here is the UI that gets generated by the Web Service Explorer to test the EGL Web Service.
In the second section of this Lab you will access an existing Web Service. The service returns
movies playing in a certain area of the US. It expects a postal code and a radius as input and
will return a list of movie theaters in the area.
Here is the UI that you will create with EGL
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 6 of 48
Now you know what you have to build in this Lab.
Let’s get started, just follow the detailed instruction in this lab script and you will learn how
easy it is to write an EGL web service.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 7 of 48
Creating and consuming Web Services with EGL
EGL implements 2 categories of services:
Æ EGL Service – a type of service for applications written entirely in EGL.
Æ EGL Web Service – a type of service that is created using EGL, but can be accessed
from both EGL and non-EGL clients.
This lab will show how to implement the creation and consuming of web services with EGL.
Services differ from traditional monolithic programs in that they are modular, and conform to a
formal specification for their data input/output (calling) mechanism. In so doing they become
more useful building blocks for applications, with artifacts that can be easily deployed to different run-times, and are far easier to maintain and reuse.
1. These services can be developed with many different technologies and languages.
However, it is useful to see what EGL and the Rational tools bring to the table as far as
building, testing and deploying services
Overview of development tasks
U
U
1. In Section I you will build an EGL Web Service. At the end of this section you should
be able to test the web services that you have created and deployed to WebSphere Application Server V6.1.
2. In Section II you will consume a 3rd party web service (not written in EGL). You will
create an EGL client that will execute this web service that exists on the web.
Section 1 – Creating EGL Web Services
2B
The steps you will perform in this section are:
1. Configure a project for Web Services: You will create a project and set it’s properties to
allow Web Service development and testing.
a. Specify Workspace Capabilities
b. Specify Web Service-specific build options
2. Define an EGL Web Service: Here you will create a new EGL Service file.
3. Code the Web Service Business Logic: In the EGL Service file you create, you will add
EGL functions and variables (statements), that perform the service (e.g. business logic)
required by your application.
4. Generate the Web Service interactively: You will then test your Web Service interactively using the Web Service Explorer tools.
Creating the application
8B
First Steps
15B
You need to start the RDI SOA workbench and select a workspace that will contain all the files
you use for your development project. You will use a new workspace so your environment fits
the environment we used when we created this script.
Start RDI SOA V 7.5
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 8 of 48
•
Click StartÆ All programs Æ IBM Software Development Platform Æ IBM Rational Business Developer Æ IBM Rational Business Developer
When prompted for a workspace name
• Enter a new name, like in the figure above, so you get a brand new workspace
Tip: Don’t worry about the directory path, accept the default, just specify a unique directory for
the workspace.
• Click OK
The workbench will show:
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 9 of 48
•
•
Click the x on the Welcome tab, to remove the Welcome page.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 10 of 48
Create an EGL web project
9B
In the RDI SOA workbench you will be using the Web perspective with all the views and editors needed to work with a web application.
The web perspective should be shown by default, if not follow the next steps to switch to it.
Switch to the Web perspective by:
•
Clicking on the open perspective icon on top right hand side of the
workbench
•
Selecting the Other… action from the context(pop up) menu
The Open Perspective dialog shows:
•
Select Web from the tree in the Open Perspective dialog
Now you are ready to create new EGL project.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 11 of 48
On the the workbench menu,
• Click File Æ New Æ Other Æ “
The Select a wizard dialog appears
:
•
•
•
Expand the EGL node
Select EGL Project
Click Next
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 12 of 48
• Name the project labplzservice.
• Be sure to select the Web Project radio button
• Click the Next button
Now you have a chance to modify the default EGL web project settings.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 13 of 48
•
•
•
•
Select WAS 6.1 or 7.0 for the target runtime,
Note: Make sure not to select a stub for a runtime.
Check that Create new project build descriptor is selected
You can leave the Show Advanced Settings checkbox unselected.
Click the Finish button
Now you need to create the logic for this service that is supposed to run when somebody invokes this service
To do this you need to create a file that contains the EGL logic and you need to name this file
and place it into a package. You will use the New EGL Service Part wizard to achieve this
task.
•
•
Expand the new labplzService project
Right click over the EGLSource folder and select: New Æ other…
In the Select wizard dialog
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 14 of 48
•
•
•
•
Expand EGL
Select Service
Click the Next> button
Enter the package name: services
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 15 of 48
•
•
•
Enter the source file name: zipService
Select.the checkbox Create as Web(SOAP) service
Click the Finish button
Now you will create some logic in this source file to provide the functionality for this service.
The service is very simple; it checks a zip code entry whether it is a valid California zip code.
Exactly, the logic checks that the input parameter value is between 90001 and 96000.
Add the following source code to zipService which opened in the editor view:
package services;
• //Save
and generate the service by pressing Ctrl/S, then Ctrl/G.
service
Since
you selected
to create a SOAP web service, the EGL deployment descriptor is automatiservice
zipService
cally updated to tell the EGL generator to create the necessary files in install this as a service, as
well creating
the WSDL
file that contains thechar(5)
interface description
of this service.
function
caTestbk(zipIn
in) returns(int)
You can check the Deployment descriptor file in Project Explorer
if(zipIn >= "90001" && zipIn <= "96000")
return(0);
else
return(-1);
end
d
•
•
•
Expand directory EGL Source
Locate the Labplzservice.egldd file (not the eglbld file which is the build descriptor)
Double click on the egldd file to open it in the editor.
You will notice, there are five tabs at the bottom:
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 16 of 48
By default the Overview tab is selected and you can see the zipService has been added
•
Click the Service Deployment tab, to get more details about the service
It shows that the service gets generated as a SOAP service
• Close the editor with DeploymentDescriptor file.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 17 of 48
The deployment descriptor has been added automatically to the build file .eglbd. This is necessary to make the Deployment descriptor known to the EGL build environment.
You might want to check the Build descriptor:
•
•
In the EGL source directory find the labplzservice.eglbld file
Open the file with the source editor by double clicking on it.
You notice that the deployment descriptor labplzservice is already listed under options.
• Close the editor.
You already generated the project when using CTRL-G in the editor so the service is ready to
be tested.
The generate action generates the complete Web Service including the WSDL file.
The WSDL is a standard file format that describes a web service. You can hand over this
WSDL file to people that want to use your Web Service. It describes the Service interface, the
location of the service and other characteristics of the service.
The WSDL (commonly pronounced as “Wis Dul”) can be opened in the WSDL editor. The file
is located in the project in WebContent\WEB-INF\wsdl\.
Here is a sample how the WSDL editor presents our WSDL file
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 18 of 48
• Feel free to double click the WSDL file and have a look.
To change the port number in the URL that points to this web service
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 19 of 48
•
•
•
•
•
•
Select the URL filed in the WSDL editor
Click the Properties tab at the bottom of the editor dialog
Change the Address information accordingly (for this lab we will be using port 9082)
Make sure the change is reflected in the editor
Save the file
Close the editor
What have you done so far?
You have created an EGL Project, created a business function and created it as
a Web Service.
Publish the Web Service – and check its port number
First let’s make sure that the application server is running.
•
•
•
Click on the Servers tab to select it
Right click over WebSphere Application Server v6.1 or 7.0
Click Start in the context menu.
Once the server has started (this may take several minutes), the console will show “Server server1
open for e-business” and the Servers tab will reflect started under the Status column.
Now you must add the project to the Server
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 20 of 48
• Right click over WebSphere Application Server v6.1
• Click Add and Remove Projects…on the context menu
The Add and Remove dialog will appear:
In the Available Projects list
• Select labplzserviceEAR
• Click Add >
The project will be moved to the right side of the window under Configured Projects
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 21 of 48
•
Click Finish.
Now publish the server
Note if you have automatic publishing turned on you don’t have to go thru these two steps.
•
•
Right click on the server in the server view
Select Publish from the context menu
It will take a couple of moments and the server will be ready, be patient. Once it is finished (the
console stops scrolling) you will be ready to test your service.
But before you get to it, we want you to make sure the port number is set correctly.
•
Double click the Console tab to open it up in the workbench
At the bottom of the console view
•
Find the VirtualHost message for the labzipservice module
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 22 of 48
•
•
Check the default host port number (In the figure above it is 9081).
Double click the Console tab to restore it back to the normal view size
The default port number for the WAS server is 9080 but if there are multiple instances of WAS
installed on your PC the installation will automatically increase the port number by one for each
additional instance of WAS to avoid port conflicts.
.
9080 is the default port number assumed by the EGL web service wizard. It has been used in the
WSDL file for your project. If the port number in the console is different than 9080, you will
need to change the WSDL file to reflect the port this service can be invoked at.
Please double click on the WSDL file and edit the WSDL file as explained before.
Note: There is also a workbench preference that you can set under Windows Æ Preferences Æ
EGL Æ Service to have the Service wizard automatically reflect the correct port number
Test the Web Service – Interactively
RDI SOA offers a nifty interactive Web Services test facility called the Web Services Explorer!
You can use this tool to test your Web Service functionality effectively, before embedding calls
to it from your service client!
To start the Web Services Explorer go in the Project Explorer
•
Expand project labplzservice
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 23 of 48
•
•
•
•
•
Expand directory WebContent
Expand directory WEB-INF
Expand directory wsdl
Right click on zipService.wsdl
Select WebServices Æ Test with Web Services Explorer
The Web Services Explorer will appear in the browser in the Content Area.
• Expand zipServiceBinding
• Click on the caTestbk method which is the service you are going to test.
In the Actions dialog
• Enter a valid California zip code 93000
• Click Go
On the bottom Status dialog you will see the result from the Web Service
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 24 of 48
You will get a return value of zero
Try the same with an input value of 99999 and the return value will be -1. These results are being
expected since this is how you coded the service.
What have you done so far?
You have now created a Web” service using EGL and tested it using the Web
Services Explorer.
You can now install the EAR file on your production server and change the
WSDL file to reflect the new location of the service and give the WDSL to potential user of the service. This will allow these folks to create applications easily that use this service.
In the next section we show you how to take a WSDL and create an EGL application that uses the
service described in the WSDL.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 25 of 48
Section 2 – Consuming a 3rd Party Web Service
3B
The steps you will perform in this section are:
1. Get a third party WSDL file from the internet.
2. Generate Web Service and Client bindings.
a. This will generate code that will allow you to access the functions defined in
the WSDL.
3. Test the 3rd party web service by creating a web page.
Let’s get started by finding a service and its WSDL file.
Find the Service
10B
You can speed up this process by using the WSDL we provide on your disk and proceed to
heading: Create an EGL Web Project.
•
You are now going to consume a 3rd party web service. To do this you must have a
working internet connection! Point your browser to www.xmethods.net.
HU
•
UH
On the homepage, click [View the Full List].
1. Find Ignyte’s Retrieve Theaters and Movie Showtimes and click on the link.
•
Right-click on the link in the row labeled WSDL and select Save Link As.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 26 of 48
• Save the file to your C:\ drive.
Make sure to select “All Files” as the file type and save the file as a dot wsdl.
Now that you have a WSDL that describes a service that provides information about movies
played in a certain area of the United States, you can write an EGL application that displays
the data provided by this service.
Create a new EGL Web project
1B
In the RDI SOA workbench in the web perspective
• Select File Æ New Æ Project Æ EGL Æ EGL project
•
•
Name it Lab7_Web_Service
Make sure Web Project is selected.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 27 of 48
•
Click Next>
•
Make sure WAS 6.1 is the selected target runtime.
Note: Don’t select WAS 6.1 stub
• Click Finish
On the next page
Now you need to create a services package, this package will contain the service information
that EGL will extract from the WSDL file, it will also contain the WSDL file itself.
Make sure you are in the Project Explorer view, not in the Enterprise Explorer view.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 28 of 48
•
•
•
Expand the Lab7_Web_Service project
Right-click over the EGL Source folder
Select New Æ EGL Package
• Enter the Package name: services
• Click Finish
Now you need to copy the wsdl file, that you downloaded before, into this package
•
In Windows Explorer, expand the C: drive
• Right mouse click over the moviefunction.wsdl on the C:\ drive
• Select copy
Now in the RDI SOA workbench
• Right-click over the services package under the LAB7_Web_Service project and select
Paste.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 29 of 48
If you pasted the WSDL in the correct location, it should now appear in the services folder
Now you are ready to extract the services information from the WSDL file.
Create Interface for web service
12B
•
•
•
In the services package
Right-click over the moviefunctions.wsdl file
Select EGL Services Æ Create EGL Client Interface from the context menu
In the upcoming dialog
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 30 of 48
If you had multiple services to work with, you could select the one you want to create an interface for.
• Click Next>
Here you could de-select the function GetUpComingMovies since you are only interested in
the function GetTheatersandMovies, but leave the default.
• Click Next>
You are now at the New EGL Web Client Binding view.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 31 of 48
The Lab7_WebService deployment descriptor is the default to add the binding to, accept the
defaults.
• Click Finish
An interface to this Web Service is created, you can now use this service and reference it in
(call from) your EGL client business logic.
This EGL source file containing the interface information of this service will be opened in the
editor in the workbench content area. It is called moviefunctions.egl and is contained in the
com.ignyte.www package.
With all service information now available you need to re-generate the project so EGL can take
this new information into consideration for this project.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 32 of 48
• Right click over the project and click Generate.
After the generation is finished.
Create a Web Page Using the Service
13B
Let’s now create a web page that utilizes this external service. From the LAB7_Web_Service
project,
•
Right click over WebContent, and select New Æ Web Page.
In the dialog that pops up,
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 33 of 48
•
•
•
•
Specify the file name as moviePage.jsp.
Pick any template under Sample Templates Æ Family A (no navigation) Æ
A_green.htpl
Uncheck Link page to template.
Click Finish.
The page will now be created and open in the page designer
Change page designer to full design view:
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 34 of 48
•
•
Click on the Design tab at the bottom of the page designer tool, this switches it from
a split view mode to a full design view
•
Add some header text as follows:
After the heading Let’s Go To The Movies
• Click the Enter key twice, to add some blank lines on the page
• Right-click anywhere within the page and select Edit Page Code.
The JSF Page Handler for moviePage.jsp opens in the editor in the content area
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 35 of 48
Change code according to the picture above and the explanations below:
Add 3 variables
• zipCode,
• radius,
• theaters.
We suggest to use content assist (ctrl + spacebar) when specifying the data type for the variable theaters this will add the import statement automatically to this EGL page handler file.
Also specify that theaters is a dynamic array by specifying the square brackets [0], the zero indicates that the array initially has zero elements.
Specify a question mark as well to allow Null.
Add a function with the name findmovies()
In this function you will invoke the web service GetTheatersAndMovies which is defined in the moviefunctions.egl source that got created for you.
First you have to declare a variable that points to the interface description MovieInformationSoap for this web service which is contained in moviefunctions.egl.
Inside the findMovies function:
• Add variable movieInformationSoap use content assist for the type and the attribute.
• The attributes for data types are specified in curly {} brackets
• Add the one assignment statement, use content assist to create the statement
This statement will return the data from the request to the web service into array
theaters.
• Save the Page Handler file moviePage.egl.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 36 of 48
• Fix any problems that get displayed
Then after the page handler source is error free
•
•
Click the moviePage.jsp tab at the top of the content area to return to the page designer
view.
Save the file to refresh/synchronize the tools.
You now need to fill the web page with controls,
You need two input fields for specifying which zip code area the theaters should be selected
from and what the radius should be that you are interested in. You also need a button on the
page to invoke the search for movie theaters (your findMovies function).
From the Page Data view at the left bottom side of the workbench,
•
•
•
•
Expand the JSF Handle node
Expand the Data node:
Select zipCode,
Drag it underneath the heading on your web page
In the window that pops up
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 37 of 48
• Select ~ Updating an existing record, which will cause an input field to be created.
• Click Options
Since you have your own button to add you don’t need the default buttons, so:
•
•
Uncheck the boxes next to Submit Button and Delete Button,
Click Finish.
• Now do exactly the same for the radius field
• Position it underneath the zipcode field
• You don’t need to change the options again, page designer will apply the same options.
There will two error message controls,
• Select one of them in page designer and press the Delete key
In Page data view :
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 38 of 48
•
•
Expand the Actions node
Drag the findMovies function underneath the radius field
The page should now look as follows:
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 39 of 48
To add the output fields that are returned from the service:
•
Drag theaters onto the page underneath the error message control.
In the window that pops up,
• Select Displaying an existing record (read-only).
Since the theaters record contains the variable Movies, which is an array, you will have to
specify how this array should look like on the page, to do this:
• Click the ellipsis next to Multi-Column Data in the Movies (Movie[]) row.
The same window will pop up but with different Columns to display.
• Select Displaying an existing record (read-only)
• Click Finish.
You will now be focused on the previous window where you clicked the ellipsis,
• Press Finish there as well.
Your page should now look as follows:
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 40 of 48
Add the application to the server
At the bottom of the workbench in the server view
•
•
Right click on the server
Select Add and Remove Programs
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 41 of 48
•
•
•
Select the Lab7WebServiceEAR
Press the Add> button, to add it to the Configured projects
Click Finish
Test the application
14B
Back in page designer
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 42 of 48
•
•
Right-click anywhere on the moviePagepage,jsp
Select Run on Server…
You might get a dialog to select the server associated with this project,
• Select WAS 6.1 for this project
•
• Click Finish
The web page appears in the build in the workbench browser
•
•
Enter a zip code, 27518 is Raleigh, NC if you don’t know a valid zip code
Enter a distance in miles for the radius to be used for example 10 .
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 43 of 48
You should see a couple of movie theaters in the region of your zip code and the movies
they are playing today.
Most likely you’ll be interested in something else the movies playing today in you business
application, but this could be any web service. You now know how to access web services
from EGL and can use this in your own business applications.
What have you done so far?
You have now generated code from a third party WSDL and created a web
page to test it! You also coded EGL business logic to run your page.
You can improve on the look of the table by changing the properties in page designer. For example, you could add borders to improve the looks and make the table more readable
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 44 of 48
Summary
4B
In this tutorial, you created an EGL application that was used as a Web service, and used an existing Web service in an EGL application. You also learned to use IBM® Rational® Business
Developer to build, test, and consume Web Services.
Visit the EGL Café to get more information, join the community.
The IBM Rational EGL Café
ibm.com/rational/cafe/community/egl
Resources
5B
Learn
• Visit the EGL Café at: http://www-949.ibm.com/software/rational/cafe/community/egl
• Visit the Rational Developer for System i resource page on developerWorks for
technical information and best practices.
• Subscribe to the IBM developerWorks newsletter, a weekly update on the best
of developerWorks tutorials, articles, downloads, community activities, webcasts
and events.
• Subscribe to the Rational Edge e-zine for articles on the concepts behind
effective software development.
• Browse the technology bookstore for books on these and other technical topics.
• IBM Enterprise Modernization Solutions
• Read other tutorials related to the Enterprise Modernization Sandbox for
System i.
• Get a Rational Developer for i for SOA Construction product overview.
• See some demos here.
Get products and technologies
• Download trial versions of IBM Rational software.
HU
U
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 45 of 48
About the authors
6B
Claus Weiss
Claus Weiss is an advisory software consultant with the Rational Software System i –
Ecosystem team at the IBM Canada Toronto Laboratory. He has degrees in industrial
engineering and computer science from the University of Hamburg in Germany. He
worked as a systems engineer with IBM Germany and joined the IBM Toronto
Laboratory in 1984. He was a developer and team leader for System/38 development
tools. He has been a member of the Design Control Group for the AS/400
development tools. He has worked as a consultant for IBM iSeries Application
Development for the past 10 years, specializing in Visual Tools. Claus is a frequent
speaker at COMMON and other iSeries conferences and a six-time winner of
COMMON's Speaker Excellence award. He is also the lead author of the book title
"Understanding the IBM WebFacing Tool," published by IBM Press, and has
co-authored several IBM Redbooks.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 46 of 48
Notices
© Copyright IBM Corporation 1992, 2009. All rights reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA
ADP Schedule Contract with IBM Corp.
This information was developed for products and services offered in the U.S.A. IBM may
not offer the products, services, or features discussed in this documentation in other countries. Consult your local IBM representative for information on the products and services
currently available in your area. Any reference to an IBM product, program, or service is not
intended to state or imply that only that IBM product, program, or service may be used. Any
functionally equivalent product, program, or service that does not infringe any IBM intellectual
property right may be used instead. However, it is the user’s responsibility to evaluate and
verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in
this documentation. The furnishing of this documentation does not give you any license to
these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing IBM Corporation
North Castle Drive
Armonk, NY 10504-1785 U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBMIntellectual
Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation Licensing
2-31 Roppongi 3-chome, Minato-ku Tokyo 106,
Japan
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 47 of 48
The following paragraph does not apply to the United Kingdom or any other country
where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS
MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIEDWARRANTIES OR CONDITIONS OF NONINFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some statesdo not allow disclaimer of express or implied warranties in certain transactions,therefore, this statement may not apply to you.
″
″
This information could include technical inaccuracies or typographical errors.Changes are
periodically made to the information herein; these changes will beincorporated in new editions
of the publication. IBM may make improvements and/or changes in the product(s) and/or
the program(s) described in this publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only
and do not in any manner serve as an endorsement of those Web sites. The materials at those
Web sites are not part of the materials for this IBM product and use of those Web sites is at
your own risk.
Licensees of this program who wish to have information about it for the purpose of enabling:
(i) the exchange of information between independently created programs and other programs
(including this one) and (ii) the mutual use of the information which has been exchanged,
should contact:
Intellectual Property Dept. for WebSphere Software IBM Corporation
3600 Steeles Ave. East
Markham, Ontario
Canada L3R 9Z7
Such information may be available, subject to appropriate terms and conditions,including in
some cases, payment of a fee.
The licensed program described in this documentation and all licensed materialavailable for it
are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or any equivalent agreement between us.
Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-levelsystems and there is no guarantee that these
measurements will be the same on generally available systems. Furthermore, some measurements may have been estimated through extrapolation. Actual results may vary. Users of this
documentshould verify the applicable data for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources.IBM has not tested
those products and cannot confirm the accuracy of performance, compatibility or any other
claims related to non-IBM products. Questions on the capabilities of non-IBM products
should be addressed to the suppliers of those products.
All statements regarding IBM’s future direction or intent are subject to change or withdrawal
without notice, and represent goals and objectives only.
Copyright license
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
EGL Web Services 48 of 48
This information contains sample application programs in source language, whichillustrates programming techniques on various operating platforms. You may copy,modify, and distribute
these sample programs in any form without payment to IBM, for the purposes of developing,
using, marketing or distributing applicationprograms conforming to the application programming interface for the operatingplatform for which the sample programs are written. These
examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.
Each copy or any portion of these sample programs or any derivative work, mustinclude a
copyright notice as follows:
© (your company name) (year). Portions of this code are derived from IBM Corp. Sample
Programs. © Copyright IBM Corp. 1992, 2009. All rights reserved
Trademarks and service marks
The following terms are trademarks or registered trademarks of International
Business Machines Corporation in the United States, other countries, or both.
• IBM
• iSeries
• Rational
• RPG/400
• System i
Intel® and Pentium® are trademarks of Intel Corporation in the United States, othercountries, or
both.
Microsoft, Windows, Windows NT® and the Windows logo are trademarks ofMicrosoft
Corporation in the United States, other countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in theUnited
States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and othercountries.
Linux is a registered trademark of Linus Torvalds in the United States, othercountries, or
both.
Other company, product or service names may be trademarks or service marks of others.
Copyright © 2009, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.
Fly UP