building web services with uddi - ibm · title: building web services with uddi author: chx created...

50
Web Services Briefing Days - Presented by IBM Spring 2002 ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 1 Web Services Briefing Days © Copyright 2002 IBM Corporation. 1 ibm.com/developerWorks/webservices o Building Web services with UDDI Doug Tidwell IBM developerWorks [email protected] ibm.com/developerWorks/webservices Web Services Briefing Days © Copyright 2002 IBM Corporation. 2 o Agenda WSDL UDDI basics UDDI4J examples UDDI:Lite examples Using WSDL and UDDI together Discovery Demo

Upload: others

Post on 16-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 1

Web Services Briefing Days © Copyright 2002 IBM Corporation. 1

ibm

.com/d

eveloperW

orks/web

services

o

Building Web services with UDDI

Doug TidwellIBM [email protected]

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 2

o

Agenda•WSDL •UDDI basics•UDDI4J examples•UDDI:Lite examples•Using WSDL and UDDI together•Discovery Demo

Page 2: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 2

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 3

o

Agenda•WebSphere Studio Application

Developer and the Eclipse project•Resources•Wrapup

Web Services Briefing Days © Copyright 2002 IBM Corporation. 4

ibm

.com/d

eveloperW

orks/web

services

o

WSDL

Describing your Web service

Page 3: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 3

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 5

o

The SOAP service app•EightBall.java consisted of an

array of 20 phrases and a random number generator.

•Nothing in the code was XML-aware, SOAP-aware, network-aware, etc.

•Despite these limitations, we deployed this code as a SOAP service.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 6

o

The SOAP client app•Most of the details of the actual

SOAP protocol were handled for us by the Call and Response objects.

•We simply focused on finding the correct data to invoke the service, then we processed the response from it.

Page 4: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 4

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 7

o

The next step•Our SOAP client hard-coded the URL,

service ID, method name, parameters, etc.

•What if we could discover these things at runtime?•That’s where WSDL and UDDI come in.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 8

o

WSDL•If we’re going to find services

automatically, we have to have a way to describe them. •I describe my service when I publish it•You describe what you’re looking for

when you search•We describe our interfaces to each other

when we meet.

Page 5: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 5

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 9

o

What’s in a WSDL file?• A WSDL file is an XML document. The

root element of the WSDL file is the <definitions> element; it defines the namespaces we’ll use. <definitions targetNamespace= “http://www.8ball.org/services”xmlns:ebs= “http://www.8ball.org/services”xmlns:xsd=“http://www.w3.org...”...>

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 10

o

What’s in a WSDL file?•The <definitions> element

contains up to six different things: •Types•Messages•Port types•Bindings•Ports•Services

Page 6: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 6

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 11

o

Types• You can define datatypes, which are

typically based on XML Schema:<types>

<xsd:schema targetNamespace=“…”><xsd:complexType

name=“questionType”><xsd:element name=“question”

type=“string”/></xsd:complexType><xsd:complexType name=“answerType”>...

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 12

o

Messages• Message definitions define the flow of

information:<message name=“IngetAnswerRequest”>

<part name=“meth1_inType”type=“ebs:questionType”/>

</message><message name=“OutgetAnswerResponse”>

<part name=“meth1_outType”type=“ebs:answerType”/>

</message>

Page 7: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 7

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 13

o

PortTypes• PortTypes define abstract operations:

<portType name=“EightBall”><operation name=“getAnswer”><input message=“ebs:IngetAnswerRequest”/><output message=“ebs:OutgetAnswerResponse”/></operation>

</message>

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 14

o

Bindings•Bindings describe the protocol used

to access a service, as well as the data formats for the messages defined by a particular portType.

•This is where things really start to come together.

Page 8: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 8

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 15

o

Bindings<binding name=“EightBallBinding”type=“ebs:EightBall”><soap:binding style=“rpc”

transport= “schemas.xmlsoap.org/soap/http”><operation name=“ebs:getAnswer”>

<soap:operationsoapAction=“urn:EightBall”/>

<input><soap:bodynamespace=“urn:EightBall” … />

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 16

o

Services and Ports• Here’s the last piece of the puzzle:

<service name=“EightBall”><port

binding=“ebs:EightBallBinding”name=“EightBallPort”>

<soap:address location= “localhost:8080/soap/servlet/rpcrouter”/>

</port></service>

Page 9: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 9

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 17

o

Back to that SOAP call…•On the next few slides, we’ll review

our SOAP call in light of our WSDL file.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 18

o

SOAP and WSDL• The SOAP code needs the URL of the

SOAP router:String endpt= call.setTargetEndpointAddress(endpt);

• WSDL:<service …

<port …<soap:address

location= />“http://www…”

“http://www…”;

Page 10: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 10

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 19

o

SOAP and WSDL• The SOAP code needs the ID (namespace)

of the service:call.setProperty(Call.NAMESPACE,

);• WSDL:

<binding …<soap:binding style=“rpc” …<operation name=“getAnswer”>

<input> ...<soap:body

namespace= “urn:Services:EightBall”

“urn:Services:EightBall”

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 20

o

SOAP and WSDL•The SOAP code needs the name of

the method:call.setOperationName( );

•WSDL:<binding …<soap:binding style=“rpc” …<operation name= >

“getAnswer”

“getAnswer”

Page 11: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 11

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 21

o

SOAP and WSDL• Finally, we need to fill in the arguments.• We can get this information from the <portType> in the WSDL file:<portType name=“EightBall”><operation name=“getAnswer”><input message=“ebs:IngetAnswerRequest”/>

• This tells us we need to use the IngetAnswerRequest message as the input to the method.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 22

o

SOAP and WSDL• Now we can look at the IngetAnswerRequest message:<message

name="IngetAnswerRequest"><part name="meth1_inType"

type="ebs:questionType"/></message>

• This message references the questionType datatype defined earlier.

Page 12: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 12

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 23

o

SOAP and WSDL• Finally, we can look at the questionType

datatype and figure out what needs to go in the method call:<xsd:complexType

name=“questionType”><xsd:element name=“question”

type=“string”/></xsd:complexType>

• We need an element called <question>that contains a string.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 24

o

SOAP and WSDL• In practice, we’ll most often write our

SOAP client code to a well-known programming interface.

• In other words, the name of the method and the arguments to it will be known beforehand.

• The URL of the SOAP router and the ID of the service can change, but the method name and parameters probably won’t.

Page 13: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 13

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 25

o

What’s next•With the WSDL file, we have all the

information we need to invoke our Web service.

•Before we do a demo of service discovery, though, we’ll talk about the UDDI registry in which all these things live…

Web Services Briefing Days © Copyright 2002 IBM Corporation. 26

ibm

.com/d

eveloperW

orks/web

services

o

UDDI basics

Publish, find, and bind

Page 14: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 14

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 27

o

UDDI•Universal Description,

Discovery, and Integration •Defines standards for a distributed

registry of Web Services:•White pages (general information)•Yellow pages (categories of services)•Green pages (business rules)

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 28

o

White pages•Information about a service provider:

•Business name•Text description (multiple languages)•Contact information (phone number,

address, etc.)•Other names (stock ticker symbols, etc.)

Page 15: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 15

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 29

o

Yellow pages•Business categories

•Three taxonomies in UDDI V1:•NAICS (North American industry codes)•UN/SPSC (ECMA product/services codes)•Geographical information

•Taxonomies have been extended in UDDI V2.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 30

o

Green pages•Information that describes how to

work with someone:•Business processes•Service descriptions•Binding information

•Language-, platform-, and implementation-agnostic

Page 16: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 16

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 31

o

Registries in the industry•IBM, Microsoft, HP, and others

are/will be providing registries of Web services.

•See www.ibm.com/services/uddifor information on IBM’s registry. You can register for a free ID and use IBM’s registry to test your own Web services.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 32

o

UDDI4J•IBM has released UDDI4J, a free,

open source implementation of the client side of UDDI.

•UDDI4J simplifies the task of interacting with a UDDI registry.

•For more information, see www-124.ibm.com/ developerworks/ projects/uddi4j.

Page 17: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 17

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 33

o

UDDIProxy•This is the main object you’ll use in

your UDDI applications. •UDDIProxy p =

new UDDIProxy();•p.setInquiryURL(“http://… ”);•p.setPublishURL(“httpshttps://… ”);

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 34

o

UDDI information•There are four information types that

are important to us:•Business information•Service information•Binding information•Information about specifications

Page 18: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 18

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 35

o

Business information•Contained in the UDDI4J BusinessEntity object

•The BusinessEntity object contains information about :•Categories•Contacts•URLs•Pricing•Other things as needed

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 36

o

Service information•Describes one or more Web services. •These are contained in the UDDI4J BusinessService object.

Page 19: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 19

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 37

o

Binding information•The technical details needed to

invoke a Web service:•URLs•Method names•Argument types, etc.

•The UDDI4J BindingTemplateobject represents this data.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 38

o

Information about specs•Metadata about the various

specifications implemented by a particular Web service.

•The UDDI spec calls these tModels; the UDDI4J TModel class represents this data.

Page 20: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 20

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 39

o

WSDL4J•IBM has also released WSDL4J,

another free, open source projectthat makes it easier to work with WSDL files.

•The library exposes the WSDL file to you as a set of objects; you don’t have to parse or process the XML yourself.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 40

o

Using WSDL4J•Definition def = WSDLReader.readWSDL(null, ou.getText());

•Service svc = def.getService( new QName("http://…",

"EightBall"));•Port prt = svc.getPort("EightBallPort");

Page 21: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 21

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 41

o

Getting WSDL4J•To get the code, visit www-124.ibm.com/ developerworks/ projects/wsdl4j.

Web Services Briefing Days © Copyright 2002 IBM Corporation. 42

ibm

.com/d

eveloperW

orks/web

services

o

Installing your own registry

Page 22: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 22

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 43

o

Prerequisites•Before you install the Private UDDI

registry, you need to install DB2 Personal Developer’s Edition.•You can get this for free at http://www-4.ibm.com/ software/data/db2/udb/ downloads.html.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 44

o

Installing DB2•To simplify things, create a userid on

your machine called wstkAdmin, with a password of wstkAdmin. This id should have root or Administrator privileges.

•Install DB2 while logged on as wstkAdmin.

Page 23: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 23

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 45

o

Installing the WSTK•Once DB2 has been set up, install

the Web Services Toolkit. Select either Full or Custom install so you can install the registry.

•During the install of the registry, enter wstkAdmin as the userid and password for the registry, and click on the Create Database button.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 46

o

Using the registry•After you’ve installed the registry, go

to either:• localhost:8080/services/uddi

(Tomcat or Embedded WebSphere)-or-• localhost:80/services/uddi

(WebSphere)•You can use HTML forms to create

UDDI entries now.

Page 24: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 24

Web Services Briefing Days © Copyright 2002 IBM Corporation. 47

ibm

.com/d

eveloperW

orks/web

services

o

Examples

Putting UDDI and WSDL through their paces

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 48

o

Examples•Our UDDI examples go through three

basic operations:•Publish to a UDDI registry•Find something in a UDDI registry•Remove something from a UDDI registry

Page 25: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 25

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 49

o

1. SaveBusinessExample•In this sample, we’re creating a new

entry in the registry:•BusinessEntity be = new BusinessEntity(“”);

•be.setName(“DougCo”);

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 50

o

2. FindBusinessExample•This example finds information in a

UDDI registry. •We’re searching for all the entries

that begin with “D”:•BusinessList bl = proxy.find_business(“D”, null, 0);

Page 26: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 26

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 51

o

3. DeleteBusinessExample•This attempts to delete anything

called “DougCo”that’s in the registry.

•If there is a “DougCo”that we didn’t create, attempting to delete it will fail.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 52

o

Creating a BusinessEntity•Using the UDDI4J APIs, here’s how

you build a new BusinessEntity:Vector entities = new Vector();BusinessEntity be = new BusinessEntity(“”, “DougCo”);

Page 27: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 27

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 53

o

Creating a BusinessEntity•Once we’ve created the BusinessEntity, we fill in its parts:

Contacts ctx = new Contacts();Vector contacts = new Vector();Contact c = new Contact("DougTidwell");

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 54

o

Creating a BusinessEntityVector av = new Vector();Address a = new Address();Vector alv = new Vector();alv.add(new AddressLine("1234 Main Street"));

alv.add(new AddressLine("Anytown, TX 73958"));

a.setAddressLineVector(alv);av.add(a);c.setAddressVector(av);

Page 28: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 28

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 55

o

Creating a BusinessEntityVector dv = new Vector();Description desc = new Description("blah, blah, blah");

desc.setLang("en");dv.add(desc);c.setDescriptionVector(dv);

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 56

o

Creating a BusinessEntityVector pv = new Vector();Phone p1 = new Phone("1-919-555-5128");

p1.setUseType("voice");pv.add(p1);Phone p2 = new Phone("1-919-555-9786");

p2.setUseType("fax");pv.add(p2);c.setPhoneVector(pv);

Page 29: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 29

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 57

o

Creating a BusinessEntitycontacts.add(c);ctx.setContactVector(contacts);be.setContacts(ctx);entities.addElement(be);BusinessDetail bd = proxy.save_business(token. getAuthInfoString(), entities);

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 58

o

Whew!•You can also do the same thing

directly with XML. All of the constructors in UDDI4J accept a DOM Node.

Page 30: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 30

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 59

o

Using XML •Here’s a brief sample:StringBuffer sb = new StringBuffer();

sb.append("<businessEntitybusinessKey=\"\">");

sb.append( "<name>DougCoManufacturing</name>");

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 60

o

Using XMLsb.append( "<contacts>");sb.append( "<contact>");sb.append( "<personName>Doug Tidwell</personName>");

sb.append( "<phone useType=\"voice\">1-919-555-5583</phone>");

sb.append( "<phone useType=\"fax\">1-919-555-2389</phone>");

Page 31: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 31

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 61

o

Parsing a StringStringReader sr = new StringReader(sb.toString());

InputSource iSrc = new InputSource(sr);

DOMParser parser = new DOMParser();parser.parse(iSrc);doc = parser.getDocument();if (doc != null)Element rootElement root = doc.getDocumentElement();

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 62

o

Using XMLVector entities = new Vector();BusinessEntity be = new BusinessEntity(rootroot);

entities.addElement(be);BusinessDetail bd = proxy.save_business(token.getAuthInfoString(),entities);

Page 32: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 32

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 63

o

Examples•Our WSDL4J examples go through

the process of interpreting a WSDL file.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 64

o

Reading the WSDL file•Definition def = WSDLReader.readWSDL(null,

ou.getText());

Page 33: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 33

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 65

o

Finding a Service•Service svc = def.getService(

new QName("http://…", "EightBall"));

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 66

o

Finding a Port•Port prt = svc.getPort("EightBallPort");

Page 34: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 34

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 67

o

Finding the SOAPAddress•List els = prt. getExtensibilityElements();

•url = new URL(((SOAPAddress)els.get(k)).getLocationURI());

Web Services Briefing Days © Copyright 2002 IBM Corporation. 68

ibm

.com/d

eveloperW

orks/web

services

o

Using WSDL & UDDI Together

Page 35: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 35

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 69

o

WSDL and UDDI Together•To bring everything together, we’ll

look at a SOAP application that gets a WSDL document from a UDDI registry, then invokes a Web Service based on the information in the WSDL document.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 70

o

The service provider•The service provider needs to create

a WSDL document and store it in the UDDI registry.

•There are many tools to create the WSDL automatically; we’ll demo one in a minute.

Page 36: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 36

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 71

o

Industry cooperation•The UDDI architects assume that in

many cases, industry groups will work together to define a set of standards to describe common services.

•This is where TModels come in.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 72

o

TModels•The BindingTemplates in the UDDI

registry refer to the appropriate TModels, indicating that they support particular standards.

•Each TModel describes a technical specification, like a wire protocol, interchange format, etc.

Page 37: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 37

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 73

o

The service requestor•The service requestor asks the UDDI

registry for the BusinessServiceobjects that reference the appropriate TModels.

•For each BusinessService, the service requestor can retrieve the BindingTemplates that describe which TModels are supported by each access point.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 74

o

The service requestor•Once the service requestor has

chosen the appropriate access point, the requestor can use the protocol and other information in the BindingTemplate to use the Web Service.

Page 38: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 38

Web Services Briefing Days © Copyright 2002 IBM Corporation. 75

ibm

.com/d

eveloperW

orks/web

services

o

Discovery demo

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 76

o

Discovery demo•Our challenge here is to use UDDI to

discover and invoke a particular Web service.

•We’ll create our UDDIProxy object, and set the URL for searches:UDDIProxy proxy = new UDDIProxy();

proxy.setInquiryURL(“http://…”);

Page 39: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 39

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 77

o

Discovery demo•Next, we’ll see if anyone in the

registry supports the Eight-Ball protocol:TModelList tml = proxy.find_tModel(“Eight-Ball Protocol” …);

Vector tModelInfoVector = tml.getTModelInfos(). getTModelInfoVector();

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 78

o

Discovery demo• Next, we’ll drill down into the TModel

structure to get the URL of the WSDL document:TModel tm = (TModel)tModelInfoVector. elementAt(j);

OverviewDoc od = tm.getOverviewDoc();OverviewURL ou = od.getOverviewURL();Definition def = WSDLReader. readWSDL(null, ou.getText());

Page 40: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 40

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 79

o

Discovery demo• Now that we have the WSDL file, we can

use the WSDL4J library to find the details we need.Service svc = def.getService(newQName(“http://www…”, “EightBall”);

Port prt = svc.getPort(“EightBallPort”);

List els = prt.getExtensibilityElements();

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 80

o

Discovery demoif (currentElement instanceofSOAPAddress)routerURL = new URL (((SOAPAddress)currentElement. get(k)).getLocationURI());

Page 41: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 41

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 81

o

Discovery demo•Hopefully at this point you’re

relatively comfortable with how SOAP, WSDL, and UDDI work together.

•The state of the art is usually about three days old, so look out for changes.•(i.e., we’re still making this stuff up!)

Web Services Briefing Days © Copyright 2002 IBM Corporation. 82

ibm

.com/d

eveloperW

orks/web

services

o

WebSphere Studio Application Developer

The future of IBM’sWeb Services tooling

Page 42: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 42

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 83

o

WS Studio App Developer•IBM’s strategic tool for developing

Web services. •We’ll use this to create a new Web

project, then deploy and test it.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 84

o

WS Studio App Developer•In this demo, we’ll take an existing

JAR file, introspect it, and get the development environment to:•Deploy the code as a Web service•Generate a proxy object•Generate a client•Compile, build, and deploy everything

so we can test it.

Page 43: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 43

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 85

o

There’s lots more…•We’ve only scratched the surface of

what WS Studio App Developer is designed to do. Database access, XML parsing and transformations, and lots of other cool things are in there, as well.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 86

o

The Eclipse project•The Eclipse project (www.eclipse.org)

is a major investment by IBM and other vendors.

•Developer tools are key to developing Web services; Eclipse is an open-source, extensible framework for building those tools.

Page 44: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 44

Web Services Briefing Days © Copyright 2002 IBM Corporation. 87

ibm

.com/d

eveloperW

orks/web

services

o

Resources

Free tools and informationto help you get started

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 88

o

developerWorks zones•dW features technology zones,

including:•Java•XML•Security•Linux•Open Source•Components

••Web ServicesWeb Services

Page 45: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 45

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 89

o

dW’s Web services zone•developerWorks features ibm.com/developer/ webservices, a free portal for Web services resources.

•Free tools, tutorials, links to other sites, sample code, etc., written in Java, Perl, Python, and Tcl.

•Let us know what you’d like to see added to the zone...

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 90

o

Web services tutorial•There is an “Intro to Web services”

tutorial at the developerWorks Web services zone.

•More tutorials are coming all the time.

Page 46: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 46

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 91

o

•The Web services (r)evolution•A four-part series (so far) that covers

the basics, including installing tools, writing SOAP applications, etc.

•The Python Web services developer•A series on building Web services with

Python

dW Web services articlesib

m.com

/develop

erWorks/w

ebservices

Web Services Briefing Days © Copyright 2002 IBM Corporation. 92

o

www.alphaworks.ibm.com•XML and Web Services Development

Environment•Web Services Toolkit

•Supports UDDI, WSDL, EJBs, and SOAP with digital signatures; Embedded WebSphere AS 3.5 included.

•XML Security Suite•Combines XML and world-class security

technology

Page 47: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 47

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 93

o

The Apache XML Project•xml.apache.org•This site contains free parsers,

stylesheet engines, server-side XML publishing tools, PDF generators, the SOAP toolkit, etc.

•Everything is free, everything is open source, and quite a bit of it was written by IBM.

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 94

o

The Apache XML Project•The SOAP toolkit (demoed earlier) is

here.•The Axis project, the follow-on to the

SOAP toolkit, is here as well. •The Web Services ToolKit from IBM

includes a preview version of Axis.

Page 48: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 48

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 95

o

UDDI

•uddi.org•IBM’s registry:

• www.ibm.com/services/uddi/

•Microsoft’s registry:• uddi.microsoft.com/

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 96

o

soaplite.com•Pavel Kulchenko’s SOAP::Lite

toolkit also has a companion toolkit, UDDI::Lite. Both are available at soaplite.com.

Page 49: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 49

Web Services Briefing Days © Copyright 2002 IBM Corporation. 97

ibm

.com/d

eveloperW

orks/web

services

o

Let’s get started!

The revolution is here…

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 98

o

The future is unwritten• If you’ve heard of these technologies,

you’re ahead of most of the industry.• Do we know how this will change the Web?• Do we have all the business models worked

out?• Do we know how the software and services

industries will change?

• No, no, and no. The rules have changed; go out there and change the world!

Page 50: Building Web Services with UDDI - IBM · Title: Building Web Services with UDDI Author: Chx Created Date: 4/17/2002 9:48:33 AM

Web Services Briefing Days - Presented by IBM Spring 2002

ibm.com/developerWorks/webservices - © Copyright 2002 IBM Corp. 50

ibm

.com/d

eveloperW

orks/web

services

Web Services Briefing Days © Copyright 2002 IBM Corporation. 99

o

Plug-a-thon

ISBN 0-596-00053-7

ISBN 0-596-00095-2

ISBN 0672321815

Web Services Briefing Days © Copyright 2002 IBM Corporation. 100

ibm

.com/d

eveloperW

orks/web

services

o

Thanks!

Doug [email protected] at ibm.com/ developerWorks/speakers/dtidwell/