You are on page 1of 84

Web Service Samir Tata GET/INT

Samir Tata

Outline
Service Orientation Web Service Web Service framework SOAP WSDL UDDI

Samir Tata

Service orientation

Samir Tata

Structured Programming
A very good thing
Service-orientation

Promise: Organization and Reuse Procedures, Functions and Data Got computing out of the stone-age

Great for its time


Monolithic, isolated server applications Asynchronous batch services Synchronous terminal services
Samir Tata 4

Object-Orientation
A very good thing
Service-orientation

Promise: Organization and Reuse Classes (Functions and Data grouped) Made developers productive

Great for its time


Monolithic, isolated c/s applications Fancy, Interactive GUIs Stateful, high-perf, low-scale servers
Samir Tata 5

Component-Orientation
A very good thing
Service-orientation

Promise: Organization and Reuse Components (Interfaces grouped) Implementation agnostic Made cross-app interaction work

Great!
Multi-Layer, Multi-Tier Applications High-Perf, High-Scale Servers
Samir Tata 6

SP, OOP, COP


The bad things
"Programming" paradigms
These are about code, not architecture Architecture follows programming model
Service-orientation

Abstract concept, concrete mapping


Mapped into Pascal, C++, CORBA, COM Reuse works only inside each domain Reuse across domains painful, at least.

None crosses org. boundaries easily Promote synchronicity


Samir Tata 7

Needs
There's little "green field" anymore
New stuff needs existing stuff Existing stuff needs new stuff
Service-orientation

Heterogeneous Systems
No single OS-family / HW-platform

Deal with "Big Bang" Effect


Access/Manipulate data from anywhere
Samir Tata 8

Wants
Reuse and organization
Service-orientation

Across layers & applications Across organization & trust boundaries

Implementation agnostic
Standards-based interaction Don't depend on language/platform

Dynamic grouping and regrouping


Near/Far clustering and distribution

Samir Tata

Service-Orientation
What is a "Service" ?
Some functional block
Location, Platform, Code are irrelevant
Service-orientation

Implications
Always assume remote use Always assume cross-platform use Ignore service's inner implementation

Samir Tata

10

SO, OO, CO, and SO


Service-orientation
Structured Granularity Contract Reusability Coupling Dependencies Communication Scope Very Fine Defined Low Tight Compile-Time Intra-Application Objects Fine Private/Public Low Tight Compile-Time Intra-Application Components Medium Public Medium Loose Compile-Time Inter-Application Services Coarse Published High Very Loose Run-Time Inter-enterprise

Samir Tata

11

Assumptions to Avoid
Don't think of a service as
Service-orientation

Transactions, Objects, Functions Synchronous or Asynchronous Stateless or Stateful The actual invocation target

Services may be
Message destinations (applications) Message handlers (infrastructure) Message carriers (transport)
Samir Tata 12

Terminology
Message
Service-orientation

Data exchanged between services Not Objects. Code doesn't travel

Context
Defines scope of action, conversation Clothes-line for state and infrastructure

Destinations
Target service or service class. Not "http://somewhere/"
Samir Tata 13

So what is a service?
Service-orientation

There really are just three types of services Message Producer type
Act and add stuff to messages

Message Consumer type


Take stuff from messages and act on it

Message Producer/consumer type

Samir Tata

14

Examples
Service-orientation

Transport Authentication Authorization Transactions Monitoring Proxies, Stubs Routing


Samir Tata 15

Web Service

Samir Tata

16

Todays Web
Web service

Web designed for application to human interactions Served very well its purpose:

Samir Tata

Information sharing: a distributed content library. Enabled B2C e-commerce. Non-automated B2B interactions. Built on very few standards: http + html Shallow interaction model: very few assumptions made about computing platforms. Result was ubiquity.
17

How did it happen?

Whats next?
Web service

The Web is everywhere. There is a lot more we can do!


E-marketplaces. Open, automated B2B e-commerce. Business process integration on the Web. Resource sharing, distributed computing.

Current approach is ad-hoc on top of existing standards.


e.g., application-to-application interactions with HTML forms. enabling systematic application-to-application interaction on the Web.
Samir Tata 18

Goal:

Web Service: definition


Web service

A Web service is a software application identified by a URI, whose interfaces and binding(1) are capable of being defined, described and discovered by XML artefacts and supports direct interactions with other software applications using XML based messages via Internet-based protocols. (W3C definition)
(1) An association between an Interface, a concrete protocol and a data format

Samir Tata

19

WS Benefits
Web service

Internet-wide standards Platform/Language independent Growing number of tools Ease of use (compared with CORBA) Support for legacy systems (wrap) Applies to loosely coupled architectures
Samir Tata 20

Web Service framework

Samir Tata

21

Web Services Framework


Web service Service Description Service Registry Find Publish Service Service Requestor Bind Service Provider Service Description

Samir Tata

22

Role of the Service Broker


The broker is a conceptual unit
May consist of several services May be distributed / decentralized
Web service

Maintains a registry of services


That's what UDDI was made for Broker services lookup via UDDI

Routing, QoS, Dispatch Trust, Security, Monitoring


Samir Tata 23

Role of the Service Provider


Provides a set of services
Line of business functionality Infrastructure functionality
Web service

Implements well-known contracts


Messages and Conversations

Exposes capabilities
Context, Transactions,

Keeps implementation details secret


Samir Tata 24

Role of the Service Consumer


Connects and controls services
User-driven interactions Workflow-driven interactions
Web service

May be a service Aggregation Doesn't worry about implementation Only worries about contracts
Messages Requested QoS Required Capabilities
Samir Tata 25

Web Services Framework


Web service

Framework can be described in terms of What goes on the wire ? Formats and protocols: SOAP. What describes what goes on the wire ? Description languages: WSDL. What allows us to find these descriptions ? Discovery of services: UDDI. What allows us to build efficient applications ? Composition of services: WSFL, BPML, BPEL4WS, XLANG, etc.

Samir Tata

26

Web Services Framework


XML Messaging
Web service Simple Object Access Protocol (SOAP) - is an XML Messaging Protocol that allows software running on disparate operating systems and different environments to make Remote Procedure Calls (RPC)
Web Service Description Language (WSDL) is a language that defines the interface of a Web service, required for interaction between a requester and a service provider

Web Services Description

Web Services Registry

Web Service Composition

Universal Description, Discovery and Integration (UDDI) serves as a business and service registry essential for the widespread use of Web services WSFL, XLANG, BPEL4WS, DAML-S are some of the XML languages that have been proposed for specifying a Web service composition

Samir Tata

27

SOAP
Simple Object Access Protocol

Samir Tata

28

Presentation Overview
What is SOAP? Components of SOAP
SOAP Envelope SOAP Encoding Rules SOAP RPC Representation


Samir Tata

The SOAP Message Exchange Model Examples of SOAP Messages SOAP Security Limitations of SOAP Implications and Conclusions
29

What is SOAP?
SOAP
stands for Simple Object Access Protocol is a communication protocol specification for invoking methods on servers, services, components, and objects. combines HTTP with XML. is designed to communicate via Internet is platform independent. is language independent. can be used in a large variety of systems ranging from messaging systems to RPC. is simple and extensible. is a format for sending messages

Samir Tata

30

Why SOAP?
Important for application development to allow Internet communication. RPC calls are not easily adaptable to the Internet. Current RPC methods represent a security problem. SOAP is platform independent. SOAP is language independent. SOAP can be used in a large variety of systems ranging from messaging systems to RPC. SOAP is simple and extensible. SOAP is a format for sending messages.

Samir Tata

31

Components of SOAP
SOAP consists of three parts:
The SOAP Envelope
is a construct that defines an overall framework for expressing what is in a message, who should deal with it, and whether it is optional or mandatory.

The SOAP Encoding Rules


defines a serialization mechanism that can be used to exchange instances of application-defined datatypes.

The SOAP RPC Representation


defines a convention that can be used to represent remote procedure calls and responses.
Samir Tata 32

The SOAP Envelope


The Envelope is the top-level container representing the message. The Header is a generic mechanism for adding features to a SOAP message in a decentralized manner without prior agreement between the communicating parties. The Body is a container for mandatory information intended for the ultimate recipient of the message.
SOAP Message HTTP Headers SOAP Envelope SOAP Header Headers SOAP Body Method Call & Data

Samir Tata

33

The SOAP Encoding Rules


Bases
the type system is a generalization of the common features found in type systems in programming languages A type is either a simple (scalar) or is a compound type constructed as a composite of several parts, each with a type These types are defined using a XML Schema

Encoding

Object type + values + XML schema XML instance XML instance + XML schema Object type + values

Samir Tata

34

The SOAP RPC Representation


One of the design goals of SOAP is to be able to encapsulate and exchange RPC calls using XML. Use this representation along with the encoding mechanism previously described. SOAP relies on Protocol Binding to provide a mechanism for carrying a RPC. An RPC call maps naturally to an HTTP request and an RPC response maps to an HTTP response. Using SOAP for RPC is not limited to the HTTP protocol binding.
Samir Tata 35

SOAP Message Exchange Model


SOAP messages are fundamentally one-way transmission from a sender to a receiver.
SOAP messages are often combined to implement patterns such as request/response.

SOAP implementations can be optimized to exploit the unique characteristics of particular network systems (protocols).
i.e. SOAP response messages to be delivered as HTTP responses when using HTTP binding.

Messages are routed along a message path which allows for processing at one or more intermediate nodes in addition to the ultimate destination.
Samir Tata 36

Message Processing
A SOAP application receiving a SOAP message must process the message as follows: Identify all parts of the SOAP message intended for that application. Verify that all mandatory parts identified in step 1 are supported by the application for this message and process them accordingly. If the SOAP application is not the ultimate destination of the message then remove all parts identified in step 1 before forwarding the message.
Samir Tata 37

SOAP Message Template


<soap:Envelope Envelop information goes here> <soap:Header> ... Header information goes here ... </soap:Header> <soap:Body> ... Body information goes here ... <soap:Fault> ... Fault information goes here ... </soap:Fault> </soap:Body> </soap:Envelope>

Samir Tata

38

The Envelope and Header Elements


The envelope element
Defines XML document as a SOAP message. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" </soap:Envelope>

soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

The header element


Contains user defined elements: language and currency. <soap:Header> <m:local xmlns:m="http://www.Computer.com/local/"> <m:language>fr</m:language> <m:currency>Euro</m:currency> </m:local> </soap:Header>
Samir Tata 39

The body element


Must be present in SOAP message. Contains actual message <soap:Envelope> <soap:Body> <m:sumRequest xmlns:m=urn:MyFirstService> <param1>25</param1> <param2>-25</param2> </m:sumRequest> </soap:Body> </soap:Envelope>
Samir Tata 40

The body element


Response <soap:Envelope> <soap:Body> <m:sumResponse xmlns:m=urn:MyFirstService> <return>0</return> </m:sumResponse> </soap:Body> </soap:Envelope> Fault (errors that occurred while processing message, Only appears in answers responses) <soap:Envelope> <soap:Body> <soap:Fault> <faultstring>Cant sum negative integers</faultstring> </soap:Fault> </soap:Body> </soap:Envelope>

Samir Tata

41

Implementations of SOAP
Axis Apache Web Services Toolkit (IBM) JAXM (Sun) ZOAP (jBoss.org) HP Web Services Platform Microsoft SOAP toolkit (VB, etc.) .NET Framework (Microsoft) Many others

Samir Tata

42

Conclusion
SOAP does not mandate an API of any kind. attempt to address the more complex distributed object protocol services such as object activation, marshaling objects/references, garbage collection, or bidirectional communications. prevent using any of the above services but they are simple implementation details that can be layered on top of the SOAP protocol (taking TIME). SOAP is inherently SIMPLE! simply defines how to access services, objects, and servers in a platform-independent manner using HTTP and XML. away allowing an increased level of interoperability. promoting further progress towards developers working together.
Samir Tata 43

References
http://www.develop.com/soap/soapfaq.htm http://msdn.microsoft.com/library/default.asp?url=/libr ary/en-us/dnsoapspec/html/soapspecindex.asp http://msdn.microsoft.com/library/default.asp?url=/libr ary/en-us/dnmag00/html/soap0300.asp http://www.w3.org/TR/SOAP/ http://www.microsoft.com/mind/0100/soap/soap.asp http://schemas.xmlsoap.org/soap/envelope http://schemas.xmlsoap.org/soap/encoding http://msdn.microsoft.com/library/default.asp?url=/libr ary/en-us/dnwebsrv/html/xmloverchap2.asp http://www.mybubble.com:8080/mybubbleEntServer/M yBubbleSoapServices.wsdl http://www.w3schools.com/soap/soap_intro.asp

Samir Tata

44

WSDL
Web Service Description Language

Samir Tata

45

Web service description using WSDL


Web services 1 Operation Operation Port WSDL n1

[ref]

WSDL Specification of Web services


Operation Operation

Web services 2 Port WSDL n2

Binding WSDL

Binding WSDL

I/O messages (request/response) constitute a WSDL operation

SOAP, HTTP, MINE

The binding define the concrete elements of the message

SOAP, HTTP, MINE

HTTP/SOAP Request Port WSDL n1 HTTP/SOAP Response HTTP/SOAP Request HTTP/SOAP Response Port WSDL n2 Web services 2 Web services 1

1 service = 1 or several ports 1 port = 1 or several operations

Server

Samir Tata

46

Introduction
What is WSDL ?
stands for Web Service Description Language is an XML document for describing web services represents the behavior of a resource on the Web

What can one knows from WSDL ?


What kind of message is exchanged ? How are the message related ?
(e.q operation input or output)

How SOAP messages are exchanged ?

Samir Tata

47

Structure of WSDL document


Interface definition
Type Messages Interfaces(Port Types)WSDL1.2

Endpoint Defintion
Bindings Protocol html , smtp Encoding Service
Samir Tata 48

Structure of WSDL document


<definitions> <types>definition of types</types> <message>definition of message</message> <interface>definition of interface </interface> <binding>definition of biding</binding> <services>definition of endpoint </endpoint> </definitions>

Samir Tata

49

The <types> element


<types> <xsd:schema targetNamespace="urn:xml-soap-address-demo xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <xsd:complexType name="phone"> <xsd:element name="areaCode" type="xsd:int"/> <xsd:element name="exchange" type="xsd:string"/> <xsd:element name="number" type="xsd:string"/> </xsd:complexType> <xsd:complexType name="address"> <xsd:element name="streetNum" type="xsd:int"/> <xsd:element name="streetName" type="xsd:string"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="state" type="xsd:string"/> <xsd:element name="zip" type="xsd:int"/> <xsd:element name="phoneNumber type="typens:phone"/> </xsd:complexType> </xsd:schema> </types>
Samir Tata 50

The <message> element


<message name="AddEntryRequest"> <part name="name" type="xsd:string"/> <part name="address" type="typens:address"/> </message> <message name="GetAddressFromNameRequest"> <part name="name" type="xsd:string"/> </message> <message name="GetAddressFromNameResponse"> <part name="address" type="typens:address"/> </message>

Samir Tata

51

The <porttype> element


One-way the endpoint receive an (<input>) message Request-response the endpoint receive an (<input>) message and return the related <output> message or one or several <fault> messages Solicit-response Le point dentre envoie un message (<output>) et recoit un message corrl (<input>) ou un ou plusieurs messages de faute (<fault>). Notification the end point send a notification message (<output>)

Samir Tata

52

The <porttype> element : example


<portType name="AddressBook"> <! One way operation --> <operation name="addEntry"> <input message="AddEntryRequest"/> </operation> <! Request-Response operation --> <operation name="getAddressFromName"> <input message="GetAddressFromNameRequest"/> <output message="GetAddressFromNameResponse"/> </operation> </portType>

Samir Tata

53

The <binding> element


<binding name="AddressBookSOAPBinding" type="AddressBook"> <soap:binding style="rpc transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="addEntry"> <soap:operation soapAction=""/> <input> <soap:body use="encoded namespace="urn:AddressFetcher2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding//> </input> </operation>

Samir Tata

54

The <binding> element


<operation name="getAddressFromName"> <soap:operation soapAction=""/> <input> <soap:body use="encodednamespace="urn:AddressFetcher2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded namespace="urn:AddressFetcher2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding>

Samir Tata

55

Binding: SOAP and SMTP


<definitions ...>

<types> <schema targetNamespace="http://stockquote.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="SubscribeToQuotes"> <complexType><all><element name="tickerSymbol" type="string"/></all></complexType></element> <element name="SubscriptionHeader" type="uriReference"/> </schema> </types> <message name="SubscribeToQuotes"> <part name="body" element="xsd1:SubscribeToQuotes"/> <part name="subscribeheader" element="xsd1:SubscriptionHeader"/> </message> <portType name="StockQuotePortType"> <operation name="SubscribeToQuotes"> <input message="tns:SubscribeToQuotes"/> </operation> </portType>

Samir Tata

56

The <binding> element


<binding name="StockQuoteSoap" type="tns:StockQuotePortType"> <soap:binding style="document" transport="http://stockquote.com/smtp"/> <operation name="SubscribeToQuotes"> <input message="tns:SubscribeToQuotes"> <soap:body parts="body" use="literal"/> <soap:header message="tns:SubscribeToQuotes" part="subscribeheader" use="literal"/> </input> </operation> </binding> <service name="StockQuoteService"> <port name="StockQuotePort" binding="tns:StockQuoteSoap"> <soap:address location="mailto:subscribe@stockquote.com"/> </port> </service> </definitions>

Samir Tata

57

The <service> element


<?xml version="1.0" ?> <definitions name="urn:AddressFetcher" targetNamespace="urn:AddressFetcher2" xmlns:typens="urn:xml-soap-address-demo" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- service decln --> <service name="AddressBookService"> <port name="AddressBook binding="AddressBookSOAPBinding"> <soap:address location="http://www.mycomp.com/soap/servlet/rpcrouter"/> </port> </service> </definitions>

Samir Tata

58

Using WSDL

As extended IDL: WSDL allows tools to generate compatible client and server stubs.
Tool support for top-down, bottom-up and meet in the middle development.

Allows industries to define standardized service interfaces. Allows advertisement of service descriptions, enables dynamic discovery and binding of compatible services.
Used in conjunction with UDDI registry

Provides a normalized description of heterogeneous applications.

Samir Tata

59

How to use WSDL?


How to use Google API with WSDL ?
Google provide standard wsdl file http://api.google.com/GoogleSearch.wsdl How to use wsdl file? Many programming languages now understand WSDL and can use this file to automatically invoke Google's API. For example, the WSDL can be imported into .NET, converted into Java code using Apache Axis WSDL2Java, or used directly by Perl SOAP::Lite.

Axis WSDL2Java tool


Generate java classes to connect to the service : ServiceLocator, Service, and mapping to the xml requests and responses of the WebServices using Axis WSDL2Java tool:
java org.apache.axis.wsdl.WSDL2Java http://api.google.com/GoogleSearch.wsdl

Samir Tata

60

Example (1) : Google API


Connect to the WebService
GoogleSearchService searchService = new GoogleSearchServiceLocator(); GoogleSearchPort searchPort = searchService.getGoogleSearchPort();

Invoke the service


GoogleSearchResult searchResult = searchPort.doGoogleSearch( clientKey, // obtained from www.google.com/apis queryString, // keywords to search on startIndex, // start index within result set 10, // maximum returned results true, "", false, "", "", ");

Samir Tata

61

Example (1) : Google API


Use the result
System.out.println("Google Search Results:"); ResultElement[] res = searchResult.getResultElements(); int lenght = Array.getLength(res); for(int i = 0; i< lenght ; i++){ ResultElement re = (ResultElement) Array.get(res,i); System.out.println("Resultat" +i); System.out.println("Title : " +re.getTitle()); System.out.println("URL : " +re.getURL()); System.out.println("Summary:" +re.getSummary()); System.out.println("Snippet:" +re.getSnippet()); System.out.println(""); }
Samir Tata 62

Example (2)
String endpoint="http://nagoya.apache.org:5049/axis/services/echo"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName(newQName("http://soapinterop.org/","echoString")); Call to addParameter/setReturnType as described in user-guide.html call.addParameter("testParam",org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_STRING); String ret = (String) call.invoke( new Object[] { "Hello!" } ); System.out.println("Sent 'Hello!', got '" + ret + "'");

Samir Tata

63

UDDI
Universal Description, Discovery and Integration

Samir Tata

64

Needs
Need to make services available Which services are available? Classes, Taxonomies, Locality Regional, legal, trust boundaries Need to find services Static and dynamic Need to negotiate capabilities Security, Context, Transactions, Reliable Messaging Need to find ways to connect

Samir Tata

65

UDDI roles
UDDI plays three roles :White pages,Yellow pages, Green pages
White pages address, contact, and known identifiers Green pages Namespace to describe how to use the service, etc... Identifier of who published the service Unique identifier (tModelKey) of this service for registration Yellow pages industrial categorisations Industry Product/Services Location

UDDI services are Web services


Samir Tata 66

UDDI Information Model

Business Entity (Provider): Information about the entity who offers a service BusinessService: Descriptive information about a particular family of technical offerings

tModel: Descriptions of specifications for services.


1n

0n

0n

BindingTemplate: Technical information about a service entry point and construction specs

Bindings contain references to tModels. These references designate the interface specifications for a service.

Samir Tata

67

Providers, Services And Bindings


Providers
Examples: Accounting Department, Corporate Application Server Name, Description, Contact Information Categorization and Identification Information

Services
Examples: Purchase Order services, Payroll services Name, Description(s) Categorization Information

Bindings
Description(s), access points, parameters Examples: Access Point (http://...) for Web Service

Samir Tata

68

UDDI
Implantation <import> <service> <port> <port> UDDI BusinessEntity BusinessService BusinessTemplate BusinessTemplate

Interface <types> <messages> <portType> <Binding> Samir Tata

tModel

69

Implantation

<wsdl:definitions name="NormAdresseService" targetNamespace="http://"> <import namespace="http://" location="http://" /> <wsdl:service name="DoNormeService"> <wsdl:port name="NormAdresseService " binding="intf:NormAdresseServiceSoapBinding"> </wsdl:service> </wsdl:definitions>

UDDI

UDDI

<BusinessEntity businessKey=""

Interface
<wsdl:definitions name="NormAdresseService.interface" targetNamespace="http://"> <wsdl:message name="getNormeResponse"> </wsdl:message> <wsdl:portType name="DoNorme"> </wsdl:portType> <wsdl:binding name="NormAdresseServiceSoapBinding" type="intf:DoNorme"> </wsdl:binding> </wsdl:definitions> </wsdl:definitions>

<name> Normalisation d'adresse </name> <businessService serviceKey=""> <name> DoNormeService </name> <BindingTemplates bindingKey=""> <TmodelInstanceInfo tModelKey=""> <overviewDoc> <overviewdocURL>http://# NormAdresseService </overviewdocURL> </BindingTemplates> </businessService> </BusinessEntity>

Samir Tata

<tModel tModelKey="" <name> http:// </name> <overviewDoc> <overviewdocURL>http://#NormAdresseServiceSo apBinding targetNamespace="http://"> </overviewdocURL> <categoryBag> <KeyedReference tModemKey="" keyname="uddiorg:types keyvalue="wsdlSpec"/> </ categoryBag > </tModel>

70

UDDI : The vision


Advanced Discovery via Portals and Marketplaces Marketplace Marketplace Marketplace Search Portal Search Portal
Business Users
Samir Tata

UDDI Registries and Protocol

Technical Users
71

Browser access: example


How does one searches ?

We are searching Web Services of Amazon.

Samir Tata

72

Browser access: example


AmazonBusiness propose a Web Service

This Web Service is called GetBookPrice

Samir Tata

73

Publishing with UDDI4J


Provider
UDDI4J

UDDI registry HTTP Server SOAP Server UDDI registry

UDDI SOAP Request UDDI SOAP Response

WSDL WebService

Samir Tata

74

Using UDDI with UDDI4J


Client
UDDI4J

UDDI registry HTTP Server SOAP Server UDDI registry

UDDI SOAP Request UDDI SOAP Response

Provider WSDL WebService

Samir Tata

75

UDDI4J
Inquiry API Find
find_business find_service find_binding find_tModel get_businessDetail get_serviceDetail get_bindingDetail get_tModelDetail

Publishers API save


save_business save_service save_binding save_tModel delete_business delete_service delete_binding delete_tModel

Find details

Delete

Security
get_authToken discard_authToken

Samir Tata

76

Program access: UDDI4J


// Construct a UDDIProxy object UDDIProxy proxy = new UDDIProxy(); try { // Select the desired UDDI server node proxy.setInquiryURL("inquiryURL"); proxy.setPublishURL("publishURL"); // Pass in userid and password registered at the UDDI site AuthToken token = proxy.get_authToken("userid","password"); ... } catch (UDDIException e) { ...

Samir Tata

77

Program access: UDDI4J


try { Vector entities = new Vector(); // Create a new business entity // BusinessKey must be "" to save a new business BusinessEntity be = new BusinessEntity("",BusinessName"); entities.addElement(be); // **** First Save a business BusinessDetail bd=proxy.save_business( token.getAuthInfoString(),entities);

} catch (UDDIException e) { ...

Samir Tata

78

Program access: UDDI4J


//creating vector of Name Object Vector names = new Vector(); names.add(new Name(config.getProperty("businessName"))); // Setting FindQualifiers to 'exactNameMatch' FindQualifiers findQualifiers = new FindQualifiers(); Vector qualifier = new Vector(); qualifier.add(new FindQualifier("exactNameMatch")); findQualifiers.setFindQualifierVector(qualifier); // Find business saved and setting the maximum rows to be returned as 5. BusinessList businessList=proxy.find_business(names,null,null,null,null,findQualifiers,5); Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector(); for( int i = 0; i < businessInfoVector.size(); i++ ){ BusinessInfo bi = (BusinessInfo)businessInfoVector.elementAt(i); System.out.println("Business Name : " + bi.getDefaultNameString()); System.out.println("Business Key : " + bi.getBusinessKey()); } Samir Tata 79

Program access: UDDI4J


// Having the business key, delete Business Entity using the authToken DispositionReport dr = proxy.delete_business (token.getAuthInfoString(), returnedBusinessEntity. getBusinessKey()); if( dr.success() ){ System.out.println("Business successfully deleted"); }else{ System.out.println(" Error during deletion of Business\n"+ "\n operator:" + dr.getOperator() + "\n generic:" + dr.getGeneric() ); }

Samir Tata

80

Web service examples


Google (http://api.google.com/GoogleSearch.wsdl) Map Quest (http://ww6.borland.com/webservices/MapQuest/MapQuest.exe/wsdl/IMapQuest) Trivia Quiz (http://java.rus.uni-stuttgart.de/quiz/quiz.wsdl) Daily Dilbert (http://www.esynaps.com/WebServices/DailyDiblert.asmx?WSDL) Global Weather (http://live.capescience.com/wsdl/GlobalWeather.wsdl)

Samir Tata

81

References
Herzum, Peter, Tutorial #20: Web Services and Service Oriented Architectures, OOPSLA 2002, Seattle, WA. Booch, G., Object oriented design with applications, Benjamin-Cummings Publishing Co., Inc., Redwood City, CA, 1990 . Kreger, Heather., Web Services Conceptual Architecture (WSCA 1.0), IBM, May 2001, http://www3.ibm.com/software/solutions/webservices/pdf/WSCA.pdf. Mani, A. and Nagarajan A., Understanding quality of service for Web Services, IBM DeveloperWorks, January 2002, http://www-106.ibm.com/developerworks/webservices/library/wsquality.html?dwzone=webservices, current October 2002. Parnas, D., On the criteria to be used in decomposing systems into modules. Communications of the ACM, 15(12):1053-1058, December 1972. Reprint: http://www.acm.org/classics/may96/ Yourdon, E. and Constantine, L., Structured Design, Englewood Cliffs, N.J.: Prentice-Hall, 1975. Stevens, M., The Benefits of a Service-Oriented Architecture, Developer.com, http://softwaredev.earthweb.com/msnet/article/0,,10839_1041191,00.html, current October 2002. Szyperski C., Component Software - Beyond Object Oriented Programming, Addison-Wesley, 1998. Tarak, M., WSIL: Do we need another Web Services Specification?, Web Services Architect, January 2002, http://www.webservicesarchitect.com/content/articles/modi01.asp, current October 2002. W3C, W3C Process Document: 5 Technical Reports, http://www.w3.org/Consortium/Process20010719/tr.html, current October 2002.

Samir Tata

82

References

Bass, Clements, and Kazman, Software Architecture in Practice, Addison-Wesley 1997. Bieber, G., Carpenter, J., Introduction to Service-Oriented Programming (Rev 2.1), http://www.openwings.org/download/specs/ServiceOrientedIntroduction.pdf, current October 2002. Fowler, M., UML Distiled: Applying the Standard Object Modeling Language, Addison-Wesley, 1997. Gamma E., Helm R., Johnson R., Vlissides, J., Design Patterns: Elements of Reusable ObjectOriented Software, Addison-Wesley, 1994. Garlan, D., Software Architecture: a Roadmap, ACM Press, 2000. Herzum, P., Web Services and Service-Oriented Architectures, Executive Report, Vol 4, No. 10, Cutter Distributed Enterprise Architecture Advisory Service, 2002. Meyer, B, Object Oriented Software Construction,Prentice-Hall, 1997, pp. 39-48. OMG, CORBA Basics, http://www.omg.org/gettingstarted/corbafaq.htm, current October 2002. Parnas, D., Clements, P, The Modular Structure of Complex Systems, IEEE, 1984. Stevens, M., Service-Oriented Architecture Introduction, Part 2, Developer.com, http://softwaredev.earthweb.com/msnet/article/0,,10527_1014371,00.html, current October 2002. Stevens, M., Multi-Grained Services, Developer.com, http://softwaredev.earthweb.com/java/sdjjavaee/article/0,,12396_1142661,00.html, current October 2002. Sun, Jini Technology Core Specification: LE-Distributed Leasing, http://wwws.sun.com/software/jini/specs/jini1.2html/lease-spec.html, current October 2002. Sun, Jini Technology Architectural Overview, http://wwws.sun.com/software/jini/whitepapers/architecture.html, 2001, current October 2002. Talking Blocks, Find Bind and Execute: Requirements for Web Service Lookup and Discovery, Whitepaper, January 8, 2001.

Samir Tata

83

References
Francisco Curbera, Web Services Overview, IBM T.J. Watson Research Center, http://www.llnl.gov/CASC/workshops/components_2001/viewgraphs/FranciscoCurbera.pd Clemens Vasters, Service Oriented Architectures, newtelligence AG, www.newtelligence.com

Samir Tata

84