+ All Categories
Home > Documents > © 2006 IBM Corporation Made available under the EPL v1.0 2006 WebSphere Services Technical...

© 2006 IBM Corporation Made available under the EPL v1.0 2006 WebSphere Services Technical...

Date post: 22-Dec-2015
Category:
View: 214 times
Download: 1 times
Share this document with a friend
Popular Tags:
109
© 2006 IBM Corporation Made available under the EPL v1.0 2006 WebSphere Services Technical Conference world class skill building and technical enablement May 1-5, 2006 Las Vegas, NV Succeed C ollaborate Learn Netw ork Succeed C ollaborate Learn Netw ork Developing Web Services Developing Web Services with Eclipse Web Tools with Eclipse Web Tools Session Number: D22 Session Number: D22 Arthur Ryman, [email protected] Arthur Ryman, [email protected]
Transcript

© 2006 IBM CorporationMade available under the EPL v1.0

2006 WebSphere Services Technical Conferenceworld class skill building and technical enablement

May 1-5, 2006 • Las Vegas, NV

SucceedCollaborate

Learn

Network

SucceedCollaborate

Learn

Network

Developing Web ServicesDeveloping Web Serviceswith Eclipse Web Toolswith Eclipse Web Tools

Session Number: D22Session Number: D22

Arthur Ryman, [email protected] Ryman, [email protected]

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 2

ObjectivesObjectives

•You will learn how to use Eclipse WTP to develop Web services

•You will learn about top-down and bottom-up service creation, client access, interoperability testing, discovery, and publication

•After this tutorial you should be able to develop Web services using WTP and products such as AST and RAD that are based on it

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Other company, product, or service names may be trademarks or service marks of others.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 3

About this tutorialAbout this tutorial

You will use WTP to develop Web services in a sequence of iterations

The example used is League Planet, a fictitious Web site for amateur sports leagues

For more information, see Chapter 10 of the forthcoming book, “Java Web Application Development Using Eclipse”

For the most benefit, you should follow along You are expected to be comfortable using Eclipse and

programming in Java Some prior knowledge of Web services would be useful

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 4

Code ExamplesCode Examples

This tutorial is based on a complete working Web application called League Planet

All source code is provided in the examples directory The directory structure is: <topic>/<iteration>/<project> e.g. webservices/iteration1/IceHockeyService/schedule.xml To make the application work, you must create some projects

and generate some code

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 5

IntroductionIntroduction

Web services have emerged as the standard technology for integrating heterogeneous systems across the Internet and intranet

e.g. services implemented on J2EETM application servers and clients implemented on .NET desktops or PHP Web servers

The key technologies are: Extensible Markup Language: XML – for messages

XML Schema Description: XSD – for message description

Web Service Description Language: WSDL – for service description

Universal Description, Discovery, and Integration: UDDI – for service registries

Web Service Interoperability: WS-I – for interoperability

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 6

Overview of IterationsOverview of Iterations

1. Developing Web Services Top-Down2. Developing Web Services Bottom-Up3. Generating Web Service Client Proxies4. Testing Web Services for Interoperability5. Using Web Services in Web Applications6. Discovering and Publishing Web Services

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 7

Iteration 1 –Iteration 1 –Developing Web Developing Web Services Top-DownServices Top-Down

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 8

Iteration 1 - Developing Web Services Iteration 1 - Developing Web Services Top-DownTop-Down

Top-Down development means designing the Web service interface first and then developing the implementation code

This approach yields the best interoperability because the underlying implementation details do not “bleed through” into the interface

This approach is required if the messages use existing industry or corporate XML document formats

You need to learn XSD and WSDL design skills Luckily, WTP has two great editors that make this task easier

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 9

Iteration 1 OverviewIteration 1 Overview

1. Use the XSD editor to describe the League Planet schedule format

2. Use the WSDL editor to describe a Web service for querying schedules

3. Use the Web service wizard to generate a Java skeleton for the service and deploy it to the Axis SOAP engine running on Tomcat

4. Fill in the implementation of the skeleton by accessing the League Planet business tier

5. Use the Web service explorer to test the Web service

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

Create a new Dynamic Web Project named Create a new Dynamic Web Project named IceHockeyService to contain the Web service.IceHockeyService to contain the Web service.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 11

Describing schedule.xmlDescribing schedule.xml

League Planet has an XML format for schedules Import IceHockeyService/schedule.xml for an example instance

document Your goal is to describe this format using XSD

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 12

Create a new XML Schema file named Create a new XML Schema file named schedule.xsd in IceHockeyService.schedule.xsd in IceHockeyService.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 13

schedule.xsdschedule.xsd

In general, there are many equivalent ways to describe a given format using XSD

For Web services, it’s a good practice to describe formats in a way that works well with XML data binding toolkits such as JAX-RPC

Define complexTypes for the content model of each element The XSD editor lets you edit in the source tab, the graphical tab,

the outline view, and the property view Try creating schedule.xsd Import IceHockeyService/schedule.xsd before proceeding

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 14

View schedule.xsd in the Graph tab of the View schedule.xsd in the Graph tab of the XSD editor.XSD editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 15

View ScheduleContent of schedule.xsd in the View ScheduleContent of schedule.xsd in the Graph tab of the XSD editor.Graph tab of the XSD editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 16

View schedule.xsd in the Outline view of XSD View schedule.xsd in the Outline view of XSD editor.editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 17

query.wsdlquery.wsdl

Now that you’ve described the message format using XSD, you next goal is to describe a Web service for retrieving it

For simplicity, the Web service will have a single operation named getSchedule

The operation will take as input, the schedule id, and return as output the corresponding schedule document

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 18

Create a new WSDL file named query.wsdl in Create a new WSDL file named query.wsdl in IceHockeyService.IceHockeyService.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 19

Enter the namespace for the WSDL and have the wizard Enter the namespace for the WSDL and have the wizard generate a skeleton document for you using the SOAP binding generate a skeleton document for you using the SOAP binding and document/literal style.and document/literal style.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 20

WSDL editorWSDL editor

You can edit the document in the graph tab, the source tab, the outline view, and the property view.

WSDL describes Web service using a hierachy of constructs: message, portType, binding, and service

The editor has a wizard that generates binding content for you Try creating query.wsdl Import IceHockeyService/query.wsdl before proceeding

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 21

View query.wsdl in the Graph tab of the WSDL View query.wsdl in the Graph tab of the WSDL editor.editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 22

View query.wsdl in the Outline view of the View query.wsdl in the Outline view of the WSDL editor.WSDL editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 23

Deploying query.wsdlDeploying query.wsdl

You have now described the Web service Your next goal is to deploy it This step assumes you have previously installed Tomcat and

added it to WTP Select query.wsdl and execute the command Web Services >

Generate Java bean skeleton This command launches the Web service wizard

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 24

Check the boxes to Install and Start the Web Check the boxes to Install and Start the Web service and click service and click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 25

The wizard validates your WSDL. Click The wizard validates your WSDL. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 26

The wizard selects Axis and Tomcat. The wizard selects Axis and Tomcat. Click Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 27

The wizard lets you select a source folder and change the The wizard lets you select a source folder and change the package name for the generated skeleton. Accept the defaults package name for the generated skeleton. Accept the defaults and click and click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 28

Click Click Start server,Start server, wait, then click wait, then click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 29

The wizard lets you publish the WSDL to The wizard lets you publish the WSDL to UDDI. Just click UDDI. Just click FinishFinish..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 30

What the wizard did.What the wizard did.

Installed the Axis SOAP engine in your project Generated the Java bean skeleton for you service and lots of

Java XML data binding classes in the src folder Copied query.wsdl to WebContent/wsdl/querySOAP.wsdl and set

its endpoint to your Web application (also copied schedule.xsd) Created the Axis deployment descriptor

WebContent/WEB-INF/server-config.wsdd Created a couple of handy Axis files to deploy and undeploy your

Web service in a subfolder of WebContent/WEB-INF Started Tomcat to make your Web service available

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 31

The IceHockeyService project after the wizard completed. The IceHockeyService project after the wizard completed. Select AxisServlet and execute the command Select AxisServlet and execute the command Run As > Run on Run As > Run on ServerServer..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 32

View the list of deployed Web services.View the list of deployed Web services.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 33

LeaguePlanetModel Business TierLeaguePlanetModel Business Tier

The Web service is running but it just returns null at this point You next need to fill in the implementation of the Java bean

skeleton The Web service needs to access the League Planet business

tier If you have not previously done so, create a new J2EE Utility

Project named LeaguePlanetModel and import the source code from LeaguePlanentModel/src into it

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 34

Select IceHockeyService and open its Properties dialog. Add Select IceHockeyService and open its Properties dialog. Add LeaguePlanetModel as a J2EE Module Dependency.LeaguePlanetModel as a J2EE Module Dependency.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 35

View the module structure of the server in the View the module structure of the server in the Servers view.Servers view.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 36

Filling in the Java bean skeletonFilling in the Java bean skeleton

You now have a Web service skeleton and access to the League Planet business tier.

Your next goal is to implement the Web service. The generated skeleton class is

com.leagueplanet.ws.query.QuerySOAPImpl Import

IceHockeyService/src/com/leagueplanet/ws/query/QuerySOAPImpl.java now

This modified skeleton simply delegates to a new class com.leagueplanet.Query to avoid confusion with the generated code

Create this new class now and try to implement it Import IceHockeyService/src/com/leagueplanet/Query.java before

proceeding

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 37

Testing the Web serviceTesting the Web service

At this point the Web service is ready to test You will test it using the Web Service Explorer Select IceHockeyService/WebContent/wsdl/querySOAP.wsdl

and execute the command Web Services > Test with Web Service Explorer

The Web Service Explorer will start and open a new Web browser in the editor area

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 38

View querySOAP.wsdl in the Web Service View querySOAP.wsdl in the Web Service Explorer. Click the getSchedule link.Explorer. Click the getSchedule link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 39

View the getSchedule operation. Enter 1 in the scheduleId field View the getSchedule operation. Enter 1 in the scheduleId field and click and click GoGo. The schedule is returned in the Status pane. . The schedule is returned in the Status pane.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 40

Double-click the Status pane to maximize it. Click the Double-click the Status pane to maximize it. Click the SourceSource link to view the SOAP message. link to view the SOAP message.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 41

View the SOAP message source. Click the View the SOAP message source. Click the FormForm link to return to the Form display. link to return to the Form display.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 42

Iteration 2 –Iteration 2 –Developing Web Developing Web Services Bottom-UpServices Bottom-Up

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 43

Iteration 2 – Developing Web Services Iteration 2 – Developing Web Services Bottom-UpBottom-Up

Bottom-Up development starts with a Java service class and generates the WSDL from it

This approach is more productive for Java developers since XSD and WSDL design skills are not required

It is suitable when the Java class uses simple data transfer objects as inputs and outputs of its operations

It is dangerous because the resulting XSD may be complex and less interoperable

There is risk of implementation “bleed through” into the service interface and coupling between the client and service

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 44

Iteration 2 OverviewIteration 2 Overview

1. Develop a Java service class to get details about a game and to update its score

2. Use the Web service wizard to deploy the service3. Use the WSDL editor to view the generated WSDL

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 45

Create the Java service implementationCreate the Java service implementation

The service implementation will be created in the package com.leagueplanet

Import the following Java classes into IceHockeyService/src/com/leagueplanet:

GameDetail.java – the data transfer class

GameException.java

ScoreException.java

Update.java – the service class The service has two operations:

getGame

updateScore The service accesses the League Planet business tier

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 46

Deploy the serviceDeploy the service

Select Update.java and execute the command Web Services > Create Web service

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 47

Check the Install and Start Web service boxes. You could click Check the Install and Start Web service boxes. You could click FinishFinish at this point since the wizard picks sensible defaults. at this point since the wizard picks sensible defaults. Click Click NextNext to step this the pages. to step this the pages.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 48

The wizard lets you select a different class. The wizard lets you select a different class. Click Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 49

The wizard lets you select a different project. The wizard lets you select a different project. Click Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 50

The wizard lets you select the methods to include as The wizard lets you select the methods to include as operations and the style to use. Click operations and the style to use. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 51

Confirm that Update was deployed using the Confirm that Update was deployed using the AxisServlet.AxisServlet.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 52

View the generated Update.wsdl in the WSDL View the generated Update.wsdl in the WSDL editor.editor.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 53

Iteration 3 –Iteration 3 –Generating Web Generating Web Service Client ProxiesService Client Proxies

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 54

Iteration 3 – Generating Web Service Client Iteration 3 – Generating Web Service Client ProxiesProxies

Web services can be invoked from programs written in many programming languages, e.g. Java, C#, PHP, JavaScriptTM etc.

Most languages support dynamic invocation and do not require any code generation

A client proxy simplifies Web service invocation by producing a class that resembles the service interface

In J2EE, client proxies are specified by JAX-RPC and its follow-on JAX-WS

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 55

Iteration 3 OverviewIteration 3 Overview

1. Use the Web service wizard to generate a Java client proxy and a JSP test client

2. Test the service using the JSP test client

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 56

Select Update.wsdl and execute the command Select Update.wsdl and execute the command Web Services > Web Services > Generate ClientGenerate Client. The wizard opens. Check the Install, Test, and . The wizard opens. Check the Install, Test, and Monitor boxes and click Monitor boxes and click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 57

The wizard validates the WSDL. Click The wizard validates the WSDL. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 58

The wizard lets you select a different client The wizard lets you select a different client project. Click project. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 59

The wizard lets you change the package for The wizard lets you change the package for the generated client proxy code. Click the generated client proxy code. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 60

The wizard lets you select the operations to include in the The wizard lets you select the operations to include in the generated JSP test client. It also lets you select a different generated JSP test client. It also lets you select a different output folder for the JSPs. Click output folder for the JSPs. Click FinishFinish..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 61

What the wizard didWhat the wizard did

Created a new Dynamic Web project named IceHockeyServiceClient

Installed Axis in IceHockeyServiceClient Generated Java proxy code including XML data binding classes

and exceptions in IceHockeyServiceClient/src/com/leagueplanet Generated JSP test client code in

IceHockeyWebContent/sampleUpdateProxy Started an instance of the TCP/IP Monitor and configured the

JSP client to use it Opened the JSP test client in a Web browser You are now ready to test the Web service

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 62

Click the getGameDetail method. Enter gameId = 1 and click Click the getGameDetail method. Enter gameId = 1 and click InvokeInvoke. View the game details in the Result pane. . View the game details in the Result pane.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 63

Click the updateScore method. Enter input parameters and Click the updateScore method. Enter input parameters and click click InvokeInvoke. The operation returns an empty result.. The operation returns an empty result.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 64

Click the getGameDetails method. Enter gameId =1 and click Click the getGameDetails method. Enter gameId =1 and click InvokeInvoke. . View the updated score in the Result pane to confirm that the View the updated score in the Result pane to confirm that the updateScore operation works correctly.updateScore operation works correctly.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 65

Iteration 4 –Iteration 4 –Testing Web Services Testing Web Services for Interoperabilityfor Interoperability

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 66

Iteration 4 – Testing Web Services for Iteration 4 – Testing Web Services for InteroperabilityInteroperability

The main value proposition of Web services is interoperability between heterogeneous systems, e.g. .NET, PHP, JavaScript

WS-I.org was established to define interoperability profiles WTP lets you validate both your WSDL and your Web service

implementations for interoperability

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 67

Click the getEndpoint method. Click Click the getEndpoint method. Click InvokeInvoke. View the endpoint . View the endpoint address in the Result pane. Note the port number.address in the Result pane. Note the port number.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 68

Open the Preferences dialog and select the TCP/IP Monitor Open the Preferences dialog and select the TCP/IP Monitor page. Note the port number of the monitor matches the page. Note the port number of the monitor matches the endpoint.endpoint.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 69

View the recorded messages in the TCP/IP Monitor view. Click View the recorded messages in the TCP/IP Monitor view. Click the Validate icon (document with checkmark).the Validate icon (document with checkmark).

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 70

The wizard lets you select a folder to store the message log The wizard lets you select a folder to store the message log file. Select IceHockeyServiceClient and click file. Select IceHockeyServiceClient and click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 71

The wizard lets you validate the message against a The wizard lets you validate the message against a WSDL file. Select Update.wsdl and click Next.WSDL file. Select Update.wsdl and click Next.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 72

The wizard lets you select the WSDL element The wizard lets you select the WSDL element to use. Select the Update port and click to use. Select the Update port and click FinishFinish..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 73

The messages are valid. In the event of errors, The messages are valid. In the event of errors, markers are placed in the generated log file.markers are placed in the generated log file.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 74

Use the Profile Compliance and Validation Use the Profile Compliance and Validation Preference page to control the level of validation.Preference page to control the level of validation.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 75

Iteration 5 –Iteration 5 –Using Web Services in Using Web Services in ApplicationsApplications

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 76

Iteration 5 – Using Web Services in Iteration 5 – Using Web Services in ApplicationsApplications

Web services can be used in applications developed with many programming languages and technologies

Web services allow alternate user interfaces to be developed Web services allow decoupling of the presentation and business

tiers within an enterprise Java applications can use JAX-RPC or JAX-WS to access both

Java and non-Java Web services

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 77

Iteration 5 OverviewIteration 5 Overview

1. Develop a user interface in IceHockeyServiceClient based on JSPs and servlets

2. Access the Update Web service from the servlet using the Java client proxy

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 78

Create a new servlet in IceHockeyServiceClient. Create a new servlet in IceHockeyServiceClient. Enter package and class names. Click Enter package and class names. Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 79

Enter a description and URL mapping. Enter a description and URL mapping. Click Click NextNext..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 80

Check the doGet and doPost boxes. Check the doGet and doPost boxes. Click Click FinishFinish..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 81

Develop the user interfaceDevelop the user interface

The wizard created and configured the UpdateScoreServlet Create two new JSPs:

score-form.jsp – to input score, has Submit button

score-confirmation.jsp – to confirm score update, has Edit button Code the servlet as follows:

doGet takes a gameId query parameter, calls the service to get the game detail, puts the game detail in the session, and forwards to score-form.jsp

doPost takes gameId, visitorScore, and homeScore query parameters, calls the service to update the score, gets the new game detail, and forwards to score-confirmation.jsp

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 82

Import the UI codeImport the UI code

Just kidding! That was way too much code to write. Import the following code into IceHockeyService:

/src/com/leagueplanet/ui/UpdateScoreServlet.java

/WebContent/score-form.js

/WebContent/score-confirmation.js

/WebContent/schedule.css

/WebContent/validator.css

/WebContent/score-validator.js Note the JAX-RPC usage pattern in the servlet

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 83

Select the updateScore servlet and execute the command Select the updateScore servlet and execute the command Run As > Run As > Run on ServerRun on Server. A GameException is thrown because you didn’t . A GameException is thrown because you didn’t provide a gameId query parameter.provide a gameId query parameter.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 84

Append ?gameId=1 to the URL and try again. Now the score Append ?gameId=1 to the URL and try again. Now the score form is displayed. Enter a new score and click form is displayed. Enter a new score and click SubmitSubmit..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 85

The score confirmation page is displayed. The score confirmation page is displayed. Click Click EditEdit to update the score again. to update the score again.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 86

Iteration 6 –Iteration 6 –Discovering and Discovering and Publishing Web Publishing Web ServicesServices

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 87

Iteration 6 – Discovering and Publishing Web Iteration 6 – Discovering and Publishing Web ServicesServices

You can look for available Web services in UDDI registries You can also publish Web services in UDDI registries UDDI provides a SOAP Web service for dynamic discovery You can also look for and publish Web services using the simpler

WSIL document format In the future, Web crawlers might harvest WSIL documents and

automatically populate UDDI registries so you can take advantage of the powerful UDDI inquiry support

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 88

Iteration 6 OverviewIteration 6 Overview

1. Explore a UDDI registry2. Explore a WSIL document3. Create a WSIL document

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 89

Launch the Web Service Explorer. Select the Launch the Web Service Explorer. Select the XMethods UDDI Registry and click XMethods UDDI Registry and click GoGo..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 90

View the registry details. Click the View the registry details. Click the FindFind link.link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 91

Enter a name for the query. Search for Services. Enter a partial Enter a name for the query. Search for Services. Enter a partial service name to search for and click service name to search for and click GoGo..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 92

View the query results. Click the service links View the query results. Click the service links to explore the services.to explore the services.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 93

View the webservicex.com service. Click the View the webservicex.com service. Click the Add to WSDL Page icon (with plus sign).Add to WSDL Page icon (with plus sign).

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 94

View the WSDL details. Click the View the WSDL details. Click the StockQuoteSOAP link.StockQuoteSOAP link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 95

View the WSDL binding details. Click the View the WSDL binding details. Click the GetQuote link.GetQuote link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 96

View the operation details. Click the Add link View the operation details. Click the Add link and enter a stock symbol. Click and enter a stock symbol. Click GoGo..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 97

View the result of the operation in the View the result of the operation in the Status pane.Status pane.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 98

WSILWSIL

As you can see from this exercise, UDDI is very complex WSIL is a simpler way to publish information about Web services WSIL can refer to WSDL, UDDI, and other WSIL documents WSIL was jointly developed by IBM and Microsoft Microsoft still uses the precursor, DISCO There is not a lot of WSIL deployed XMethods supports it and several other technologies

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 99

Surf to Surf to http://www.xmethods.nethttp://www.xmethods.net. Click the . Click the Access link.Access link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

0

View the many access methods supported by View the many access methods supported by XMethods. Copy the WS-Inspection link.XMethods. Copy the WS-Inspection link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

1

Open the WSIL page of the Web Service Explorer (page with globe Open the WSIL page of the Web Service Explorer (page with globe icon). Paste in the XMethods WSIL URL, select WSDL Services, and icon). Paste in the XMethods WSIL URL, select WSDL Services, and click click GoGo..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

2

View the list of WSDL services registered at View the list of WSDL services registered at XMethods.XMethods.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

3

Create an new inspection.wsil file in Create an new inspection.wsil file in IceHockeyService/WebContentIceHockeyService/WebContent

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

4

Edit inspection.wsilEdit inspection.wsil

Select IceHockeyService/WebContent/wsdl/querySOAP.wsdl and execute the command Web Services > Generate WSIL to create querySOAP.wsil

Repeat for Update.wsdl Merge the contents of these into inspection.wsil and add

abstracts Import IceHockeyService/WebContent/inspection.wsil before

proceeding

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

5

Enter Enter http://localhost:8080/IceHockeyService/inspection.wsilhttp://localhost:8080/IceHockeyService/inspection.wsil in in WSIL page, select WSDL Services and click WSIL page, select WSDL Services and click GoGo..

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

6

View the available WSDL services. Click the View the available WSDL services. Click the QuerySOAP.wsdl link.QuerySOAP.wsdl link.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

7

View the QuerySOAP.wsdl details.View the QuerySOAP.wsdl details.

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

8

Web Services SummaryWeb Services Summary

In this tutorial you have covered all the major functional areas of Web service development that are available in WTP

Tools covered included the Web Service Wizard, Web Service Explorer, XSD Editor, WSDL Editor, TCP/IP Monitor, and WS-I Test Tools

Technologies covered include XSD, WSDL, SOAP, UDDI, WSIL, JAX-RPC, and Axis

For further details consult the WTP Help and Web site

2006 WebSphere Services Technical Conference© 2006 IBM Corporation 10

9

QuestionsQuestions

•Please complete your session evaluation•Thank you


Recommended