Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Web Services Oh-kyoung Kwon CSD programming languages lab. 2001.05.24.

Similar presentations

Presentation on theme: "1 Web Services Oh-kyoung Kwon CSD programming languages lab. 2001.05.24."— Presentation transcript:

1 1 Web Services Oh-kyoung Kwon CSD programming languages lab. 2001.05.24

2 2 Contents Web Services Base Technologies –SOAP –UDDI –WSDL

3 Introduction : Until now The Web has provided for –browsing of linked documents –manually-initiated purchases and transactions –downloading files all of this is manual, by way of a browser

4 Introduction : Web Services Web Services is a new model for using the Web –transactions initiated automatically by a program, not necessarily using a browser –can be described, published, discovered, and invoked dynamically in a distributed computing environment –new ways of using the web: intelligent agents, marketplaces, auctions all built on XML and other internet standards!

5 What are Web Services? The next evolution of e-business –abstraction beyond object-oriented technology –publishing of business functions to the Web –universal access to these functions A natural extension to the client-server model –transaction model for e-business –layered services: server can also be a client of services shift from client-server to peer-to-peer architecture

6 Examples of Web Services Business Information with rich content –weather reports, credit check, news feed, credit card validation, airline schedules, request for quote, stock quotes Transactional Web Services for B2B or B2C –airline reservations, supply chain management, rental car agreements, purchase order Aggregation –future application will be built from web services that are dynamically selected at runtime based on their cost, quality and availability.

7 Features Interoperability –Any Web service can interact with any other Web service Ubiquity –any device which supports standard protocols can both host and access Web services Low barrier to Entry –concept is easy, and free toolkits allow developers to create and deploy Web services Industry Support –.NET framework

8 SOA : Service Oriented Architecture Service Provider Service Requester Service Broker Bind Find Publish

9 SOA : Details Service Provider –provides e-business services –PUBLISHES availability of these services through a registry Service Requestor –FINDS required services via the Service Broker –BINDS to services via Service Provider Service Broker –provides support for publishing and locating services –like telephone yellow pages

10 Base Technologies SOAP - Simple Object Access Protocol –an XML protocol to invoke a method on a server to execute –a requested operation and get a response in XML –request message is sent by service requestor –response message is sent by service provider UDDI - Universal Description, Discovery, Integration –UDDI servers act as a directory of available services and service providers –SOAP can be used to query UDDI for services WSDL - Web Services Description Language –an XML vocabulary to describe service interfaces

11 11 SOAP Simple Object Access Protocol

12 Brief History Features : pros and cons SOAP structure SOAP/HTML Request and Response Examples using Apache-SOAP

13 RPC processes versus OO interactions OO interactions –you invoke a method, that method completes, and the result is returned RPC –message-based A message was sent to the server at some point, a message saying "OK, I'm done" will be received from that server

14 Its SOAP Time The data sent to the machine has to be encoded –RPC : XDR(External Data Representation) encoding format –XML-RPC : XML, 98 SOAP : 2 items added to XML-RPC –envelope, which carries information about the included message –a set of rules for encoding application-specific data types.

15 Simple Object Access Protocol SOAP 1.0: Userland, Microsoft, DevelopMentor –SOAP 1.0 was specific to COM and HTTP SOAP 1.1 (April 23, 2000) - includes –contributions from IBM and Lotus –substitutable Transport bindings (not just HTTP) –substitutable Language bindings (e.g. Java) –substitutable Data encodings (pluggable) –completely vendor-neutral –independent of: programming language, object model, operating system, or platform Service Oriented Architecture

16 Simplity easily be adapted to existing technologies such as HTTP or SMTP e.g) attempt to turn web servers into object servers (middle-tier servers in a three-tier architecture) Drawback –limited to inheritance, lacks transaction management

17 Simplity (cont.) SOAP is a text-based protocol, while others are binary protocols –debug, firewall(easy for intermediaries to process message) SOAP appeals to all vendors –Microsoft.NET Framework –IBM has also created an excellent SOAP toolkit for Java programmers –ebXML (OASIS and UN)

18 SOAP Message Structure Request and Response messages –Request invokes a method on a remote object –Response returns result of running the method SOAP defines an "envelope" –"envelope" wraps the message itself –message is a different vocabulary –namespace prefix is used to distinguish the two parts message application-specific message vocabulary SOAP vocabulary

19 19 SOAP Request Message John SOAP Envelope Namespace for wrapping messages message namespace

20 20 Deployment package hello; public class HelloServer { public String sayHelloTo(String name) { return "Hello " + name + ", How are you doing?"; } }

21 21 SOAP Response Message Hello John, How are you doing? Resulted in Body

22 22 SOAP hides the service implementation from requester

23 23 Client Java Program // Build the call. Call call = new Call(); call.setTargetObjectURI("urn:Hello"); call.setMethodName("sayHelloTo"); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); Vector params = new Vector(); params.addElement(new Parameter("name", String.class, name, null)); call.setParams(params); // Invoke the call. Response resp = call.invoke(http://localhost:8080/apachesoap/servlet/rpcrouter, ""); Client Java Program

24 SOAP consists of Envelope –define a framework for describing what is in a message and how to process it Encoding rules –expressing instances of application-defined datatypes RPC representation –representing RPCs and responses

25 Envelope Header –who should deal with a feature(SOAP actor) –where it is optional or mandatory(mustUnderstand) Body –container for mandatory information –include following information RPC calls Fault element

26 Encoding rules based on a simple type system that is a generalization of the common features operates on two levels –given a schema consistent with the type system described, a schema for an XML grammar maybe constructor –given a schema and a particular graph of value, an XML instance may be constructed

27 Encoding rules (cont.) The value of type is determined by –xsi:type attribute –reference to a schema (notation is described by XML Schema) Simple value –one without named parts –a type that is listed XML Schema such as strings, integers, enumerated values, arrays of bytes

28 Encoding rules (cont.) Compound value –aggregation of relations to other values –encoded as a sequence of elements –array : ordinal position servers as the distinction –struct : element name is the distinction

29 RPC representation To make a method call, following is needed –The URI of the target object –A method name –An optional method signature –The parameters to the method –Optional header data method calls and responses are both carried in the SOAP Body element

30 Using SOAP in HTTP HTTP application must use the media type text/xml binding only defines SOAP within HTTP POST requests use SOAPAction HTTP Header Field when issuing a SOAP HTTP Request follows the semantics of the HTTP Status code

31 SOAP/HTTP Request and Response ClientServer 1. deployment 2. request deploymen t file rpcrouter servlet encoding to xml decoding from xml deploymen t process... 3. result SOAP engine... encoding to xml reading xml & call method check SOAPActi on Field

32 Examples –SOAP Service provider Service Name:Currency Exchange Rate XMethods ID Number:5 Service Owner:xmethods Contact Description:Exchange rate between any two currencies, Takes in country1 and country2, and returns the exchange rate between currencies SOAP Endpoint URL: SOAPAction:None Needed Method Namespace URI:urn:xmethods-CurrencyExchange Method Name(s):getRate WSDL URL :

33 33 UDDI Universal Description, Discovery, and Integration

34 34 Introduction Interoper ation Stack Universal Service Interop Protocols (these layers are not defined yet) Universal Description, Discovery Integration (UDDI) Simple Object Access Protocol (SOAP) Extensible Markup Language (XML) Common Internet Protocols (HTTP, TCP/IP)

35 35 What is UDDI? Universal Description, Discovery, and Integration A project to speed interoperability and adoption for web services –Standards-based specifications for service description and discovery –Shared operation of a web-based business registry –Partnership among industry and business leaders - more than 70 companies have signed up so far

36 36 Discover businesses worldwide that offer the exact products and services that you need. Register the products and services of your own business for others to discover. Or both. Technology and business champions are leading the development and deployment of an open, Internet- based Universal Description, Discovery, and Integration (UDDI) specification. UDDI is the building block that will enable businesses to quickly, easily and dynamically find and transact business with one another using their preferred applications.

37 37 Problems UDDI Solves Broader B2B Smarter Search Easier Aggregation A mid-sized manufacturer needs to create 400 online relationships with customers, each with their own set of standard and protocols A flower shop in Australia wants to be plugged in to every marketplace in the world, but doesnt know how A B2B marketplace cannot get catalog data for relevant suppliers in its industry, along with connections to shippers, insurers, etc. Describing Services Discover Services Integrate them Together

38 38 UDDI Vision and Process 1.Start with existing standards –TCP/IP, HTTP, XML –Industry-specific schemas –Shared vision of open protocols 2. Augment and implement via a Web Service –Common web services stack –Shared implementation to avoid confusing customers –Public specs, open service, inclusive process

39 39 SOA Functions Service Provider Service Requester Service Broker Bind : how an application connects to, and interacts with a web service after its been found Find : how an application finds a particular web service Publish : how the provider of a web service registers itself

40 40 Registry Data White pages : information such as the name, address, and telephone number of a given business Yellow pages : information that categorizes business. Based on existing standards Green pages : technical information about the web services provided by a given business

41 41 Service Types Business Information (BusinessEntity) –services, categories, contracts, URLs, and other things necessary to interact with a given business Service Information (BusinessService) –describe a group of web services Binding Information (BindingTemplate) –the technical details necessary to invoke a web service. URLs, method names, argument types... Information about specifications for services (TModel) –metadata about the various specification implemented by a given web service

42 42 UDDI4J Find a business in the UDDI registry UDDIProxy proxy = new UDDIProxy(); proxy.setInquiryURL( registry/inquiryapi); registry/inquiryapi proxy.setPulibshURL( registry/protect/publishapi); registry/protect/publishapi BusinessList bl = proxy.find_business(S, null, 0); Vector businessInfoVector = bi.getBusinessInfos.getBusinessInfoVector(); for (int i=0;i<businessInfoVector.size();i++) { BusinessInfo businessInfo = (BusinessInfo)businessInfoVector.elementAt(i); System.out.println(businessInfo.getNameString()); }

43 43 UDDI4J (cont.) Publish a business listing AuthToken token = proxy.get_authToken(userid, password); Vector entities = new Vector(); BusinessEntity be = new BusinessEntity(); be.setName(Sample business); entities.addElement(be); BusinessDetail bd = proxy.save_business(token.getAuthInfoString(), entries); Vector businessEntities = bd.getBusinessEntityVector(); BusinessEntity returnedBusinessEntity = (BusinessEntity) (businessEntities.elementAt(0)); System.out.println(Returned businessKey + returnedBusinessEntity.getBusinessKey());

44 44 UDDI4J (cont.) Unpublish a business listing BusinessList bl = proxy.find_business(Sample business, null, 0); Vector businessInfoVector = bi.getBusinessInfos.getBusinessInfoVector(); for (int i=0;i<businessInfoVector.size();i++) { BusinessInfo bi = (BusinessInfo)businessInfoVector.elementAt(i); System.out.println(Business key : + bi.getBusinessKey()); DispositionReport dr = proxy.delete_business(token.getAuthInfoString(), bi.getBusinessKey()); }

45 45 Web Service Describing Language Describing Services and Service Providers

46 46 What is WSDL describe XML-based network services regardless of communication protocol and request structure XML equivalent of a resume –what a web service can do –where it resides –how to invoke WSDL is the convergence of IBM's NASSL and Microsoft's SDL –Some Web Services docs may refer to old names

47 47 XML Structure (1/4) element : contains the definition of one or more services...... How the operations are invoked... Where the service is located What operations the service provides

48 48 XML Structure (2/4) What operations the service provides

49 49 XML Structure (3/4) How the operations are invoked <soap:body encodingStyle=... namespace=urn:weather-service use=encoded/> <soap:body encodingStyle=... namespace=urn:weather-service use=encoded/>

50 50 XML Structure (4/4) Where the service is located <port binding=Weather_ServiceBinding name=Weather_ServicePort> http://localhost:8080/soap/servlet/rcproupter

51 51 WSDK Toolkit Stub class generate java –in Wheather_Service.wsdl Weather_ServiceProxy class Weather_ServiceProxy weather = new Weather_ServiceProxy(); float temp = weather.getTemp(75248); System.out.println(temp = + temp); test client program

Download ppt "1 Web Services Oh-kyoung Kwon CSD programming languages lab. 2001.05.24."

Similar presentations

Ads by Google