Skip to main content

skip to main content

developerWorks  >  Rational | SOA and Web services  >

Creating and Consuming Web Services Using IBM Rational Business Developer (EGL)

developerWorks
Go to the previous pagePage 5 of 9 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
3428 KB (9 pages)

Get Adobe® Reader®


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Consuming a third-party Web service

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.
    1. This will generate the code that will allow you to access the functions defined in the WSDL file.
  3. Test the third-party Web service by creating a Web page.

Start by finding a service and its WSDL file.

Find a third-party service

You can speed up this process by using the WSDL provided on your disk, and proceed to the heading: Create an EGL Web Project.

You are now going to consume a third-party Web service. To do this you must have a working Internet connection.

  1. Point your browser to www.xmethods.net.
  2. On the homepage, click the [View the Full List] link, as shown in Figure 27.

Figure 27. XMethods home page
Page with navigable links
  1. Find Ignyte’s Retrieve Theaters and Movie Showtimes and click the link, as shown in Figure 28.

Figure 28. Navigate to the Movie Showtimes application
link and description of application
  1. Right-click the link in the row labeled WSDL, and select Save Link As, as shown in Figure 29.

Figure 29. Save the application locally
menu command
  1. Save the file to your C:\ drive. Make sure to select All Files as the Save as type, and save the file with a .wsdl extension.

Figure 30. Saving the file
file name moviefunctions.wsdl

Now that you have a WSDL file that describes a service that provides information about movies playing 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

  1. In the Rational Developer for System i SOA workbench, in the Web perspective (Figure 31):
    1. Select File > New > Project > EGL > EGL project.
    2. Name it Lab7_Web_Service.
    3. Make sure that Web Project is selected.
    4. Click Next.

Figure 31. Enter project name and select project type
choose Web, General, or Plug-in project type
  1. Make sure that WebSphere Application Server v6.1 is the selected Target Runtime, as shown in Figure 32.
  2. Click Finish.

Figure 32. Specify the general settings for the EGL Web Project
radio buttons for Build Descriptor Options

Next, you need to create a services package. This package will contain the service information that EGL will extract from the WSDL file, as well as the WSDL file itself.

  1. Right-click the EGL Source folder.
  2. Select New > EGL Package, as shown in Figure 33.

Figure 33. Create a services package
menu command
  1. Enter the Package name services, as shown in Figure 34.
  2. Click Finish.

Figure 34. Create an EGL Package
specify the Source folder and Package name

Now you need to copy the wsdl file (which you downloaded previously) into this package.

  1. In Windows Explorer, expand the C:\ drive.
  2. Right-click moviefunction.wsdl on the C:\ drive, as shown in Figure 35.

Figure 35. Select file to copy
Explorer view of the C drive
  1. Select copy
  1. In the Rational Developer for System i SOA workbench, right-click the services package under the LAB7_Web_Service project and select Paste.

If you pasted the WSDL in the correct location, it should now appear in the services folder, as shown in Figure 36.


Figure 36. Location of moviefunctions.wsdl
file highlighted in tree view


Back to top


Extract the services information

Next, extract the services information from the WSDL file.

  1. Go back to the services package.
  2. Right-click moviefunctions.wsdl and select EGL Services > Create EGL Client Interface,

Figure 37. Create a client interface
menu command
  1. Click Next in the New EGL Part dialog, as shown in Figure 38.

Figure 38. Create EGL interfaces from a WSDL file
tree view
  1. From the available functions shown in Figure 39, you could clear GetUpComingMovies (because you are only interested in GetTheatersandMovies), but leave the default.
  2. Click Next.

Figure 39. Specify folder, package, file, and functions
dialog with fields on top, tab on bottom

You are now at the New EGL Web Client Binding view.

The Lab7_WebService deployment descriptor is the default to add the binding to.

  1. Accept the defaults and click the Finish button, as shown in Figure 40.

Figure 40. Add EGL Web client bindings
dialog with Port, Interface Name, and Binding Name

An interface to a third-party Web service is created. You can use this service and reference it in (call it from) your EGL client business logic. The EGL source file containing the interface information of this service will be opened in the content area. It is called moviefunctions.egl and is contained in the com.ignyte.www package.

With all of the service information now available, you need to re-generate the project so that EGL can take this new information into consideration for this project.

  1. Right click the project and click Generate, as shown in Figure 41.

Figure 41. Re-generate the project
menu command

The generation finishes.



Back to top



Go to the previous pagePage 5 of 9 Go to the next page