Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP 4991 Component Based Software Development Lecture #3 Web Services Onyeka Ezenwoye.

Similar presentations


Presentation on theme: "COP 4991 Component Based Software Development Lecture #3 Web Services Onyeka Ezenwoye."— Presentation transcript:

1 COP 4991 Component Based Software Development Lecture #3 Web Services Onyeka Ezenwoye

2 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

3 Homework 1 Client DNS Server HTTP Server String GET(String) RMI registry http://math.com/addInt?..... http://mathObj/addInt?..... 8

4 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

5 Enterprise A Java RMI App 1App 2 Enterprise B COM App 1App 2 Enterprise C CORBA App 1App 2 COM/RMI bridge COM/CORBA bridge

6 Enterprise A Java RMI App 1App 2 Enterprise B COM App 1App 2 Enterprise C CORBA App 1App 2 COM/RMI bridge COM/CORBA bridge protocol change

7 Subscribe Publish Bind Service Consumer Client Service Provider Service Service Registry Serviced description Legend request flow reply flow program boundary module boundary Reply Service Description

8 What are Web Services? Applications that can be published, located and invoked programmatically over the Web. Self-contained functions that can be used individually to provide services. A web service is a remote procedure call over the Internet using XML messages.

9 Advantages of Web Services Cross-platform, cross-language support –Java,.NET, PHP, Perl, Python Based on industry standards (W3C) –Catches the XML wave –XML, SOAP, WSDL Supported by many vendors –Unlike CORBA, COM, etc Service publication and lookup –Conduct business without prior relationship Loosely coupled

10 Web Services Technologies The Protocol Stack Service Discovery –UDDI Service Description –WSDL (XML-based) Messaging –SOAP (XML-based) Service Transport –HTTP, SMTP etc. XML Messaging Service Transport Service Discovery Service Description

11 Web Services Programming Model RPC-based: Synchronous model. Similar to RMI and DCOM. Request/response interaction Message-based: Document-driven. Asynchronous model. Publish/subscribe interaction

12 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

13 Markup History SGML (Standard Generalized Markup L): complex, few reliable tools HTML (HyperText ML): simple, unprincipled, mixes structure and display XML (eXtensible ML): simple, yet extensible subset of SGML to capture new vocabularies –Machine processible –Comprehensible to people: easier debugging

14 XML Basics and Namespaces <arbitrary:toptag xmlns=“http://one.default.namespace/if-needed” xmlns:arbitrary=“http://wherever.it.might.be/arbit-ns” xmlns:random=“http://another.one/random-ns”> Optional text also known as PCDATA <!– compare with arbitrary:atag above 

15 Namespaces Many documents can have identical elements that denote different things –Namespaces are the XML way to classify elements In general, a namespace is just a tag –An arbitrary string –Defined to be a URI A common practice to store a schema –Some XML validators use these

16 Example namespace <!-- the "edi" prefix is bound to http://ecommerce.example.org/schema for the "x" element and contents --> <!-- the 'taxClass' attribute's namespace is http://ecommerce.example.org/schema --> Baby food

17 Parsing and Validating An XML document maps to a parse tree. –Each tag ends once: nesting structure (one root) –Each attribute occurs at most once; quoted string Well-formed XML documents can be parsed Applications have an explicit or implicit syntax for their particular XML-based tags –If explicit, may be expressed in DTDs and XML Schemas Best referred to definitions elsewhere XML Schemas, expressed in XML, are superior to DTDs –When docs are produced by external components, they should be validated

18 XML Schemas “Schemas” is a general term--DTDs are a form of XML schemas –According to the dictionary, a schema is “a structured framework or plan” When we say “XML Schemas,” we usually mean the W3C XML Schema Language –This is also known as “XML Schema Definition” language, or XSD DTDs and XML Schemas are all XML schema languages

19 Why XML Schemas? DTDs are written in a strange (non-XML) format –You need separate parsers for DTDs and XML The XML Schema Definition language solves these problems –XSD gives you much more control over structure and content –XSD is written in XML

20 Referring to a schema To refer to an XML Schema in an XML document, the reference goes in the root element: – (This is where your XML Schema definition can be found)...

21 Simple and complex elements A “simple” element is one that contains text and nothing else –A simple element cannot contain other elements –May not be empty –The text can be of many different types, and may have various restrictions applied to it If an element isn’t simple, it’s “complex” –A complex element may have attributes –A complex element may be empty, or it may contain text, other elements, or both text and other elements

22 Defining a simple element A simple element is defined as where: –name is the name of the element –the most common values for type are xs:booleanxs:integer xs:date xs:string xs:decimalxs:time

23 Defining an attribute Attributes themselves are always declared as simple types An attribute is defined as where: –name and type are the same as for xs:element

24 Complex elements A complex element is defined as says that elements must occur in this order

25 xs:sequence We’ve already seen an example of a complex type whose elements must occur in a specific order:

26 xs:all xs:all allows elements to appear in any order The members of an xs:all group can occur once or not at all Use minOccurs="n" and maxOccurs="n" to specify how many times an element may occur –In this context, n may only be 0 or 1

27 Referencing Once you have defined an element or attribute (with name="..." ), you can refer to it with ref="..." –

28 SOAP XML-based protocol for exchanging structured and typed information A SOAP message is formally specified as XML A stateless, one-way message exchange paradigm RPC, Message Exchange Transport is mostly HTTP (POST)

29 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

30 SOAP (2) Defines a standard format for the message exchange Envelope –Root element of the SOAP XML Header –Optional element –Message routing information –Security –Context and transaction management information –Processing instructions for intermediaries and receiver Body –Mandatory element –Contains the message payload

31 Soap Message Structure of SOAP Messages Envelope (required) Header (optional) Body (required) Fault (optional)

32 SOAP HTTP Request Example POST /SampleWebServiceWeb/servlet/rpcrouter HTTP/1.0 Host: localhost:9080 … IBM

33 SOAP HTTP Response Example HTTP/1.1 200 OK Server: WebSphere Application Server/5.0 … 34.5

34 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

35 What is WSDL? Web Service Description Language XML Based Language for describing web services and how to access them WSDL is similar to the Java Language Interfaces

36 What is WSDL? (2) WSDL describes four pieces of critical data: Interface information describing all publicly available operations Data type declarations for all message requests and responses Binding information about the transport protocol Address information for locating the service

37 The WSDL Spec definitions types message portType binding service documentation import

38 The Main Structure of WSDL schema types … a set of operations communication protocols a list of binding and ports

39 Learning by Example <definitions name="WeatherService“ targetNamespace="http://www.ecerami.com/wsdl/WeatherService.wsdl“ xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.ecerami.com/wsdl/WeatherService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicefaqs.html?page=2

40 Learning by Example (2) <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:weatherservice" use="encoded"/> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:weatherservice" use="encoded"/> http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicefaqs.html?page=2

41 Learning by Example (3) WSDL File for Weather Service <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicefaqs.html?page=2

42 How do I use WSDL? Create a SOAP client to invoke the service –Clients Automatically invoke the service with a WSDL invocation tool –Clients: Web Service Invocation Framework (WSIF)

43 RPC Client Call Client Stub Pack and send parameters Receive and unpack parameters Pack and send results Execute procedure Return Receive and unpack results Server StubServer Message

44 Java Client Client stub Or WSIF AXIS SOAP Engine Java application SOAP Web Server Java Web Services

45 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

46 What is UDDI? Universal Description, Discovery and Integration.

47 What is UDDI? (2) The UDDI Project is an industry initiative that is working to enable businesses to quickly, easily, and dynamically find and transact with one another. UDDI enables a business to: –Describe its business and its services –Discover other businesses that offer desired services –Integrate with these other businesses.

48 What is UDDI? (3) At its core, UDDI consists of two parts. –Technical specification –The UDDI Business Registry Basically, just a phone book

49 Core Data Types businessEntity –Business Details (name, contacts, etc.) –White pages businessService –Web services provided by business (online-ordering, etc.) –Yellow pages bindingTemplate –Technical details to invoke Web services –Green pages tModel –Technical fingerprints used to access service specifications

50 How Do I use UDDI? Use a registrar’s interface. Use UDDI API’s using SOAP messages Use other API’s. E.g. UDDI4J, jUDDI, etc.

51 Registry APIs (SOAP Messages) Inquiry API –find_business –find_service –find_binding –find_tModel –find_relatedBusinesses –get_businessDetail –get_serviceDetail –get_bindingDetail –get_tModelDetail –get_businessDetailExt Publishers API –save_business –save_service –save_binding –save_tModel –add_publisherAssertions –delete_business –delete_service –delete_binding –delete_publisherAssertions –delete_tModel –get_authToken –discard_authToken –get_registeredInfo –get_assertionStatusReport –get_publisherAssertions –set_publisherAssertions

52 Access UDDI via API’s SOAP and XML Schema are the basis User UDDI SOAP Request UDDI SOAP Response UDDI Registry Node HTTP Server SOAP Processor UDDI Registry Service B2B Directory Create, View, Update, and Delete registrations Implementation- neutral © Copyright 2000 By Ariba, Inc., International Business Machines Corporation and Microsoft Corporation. All Rights Reserved.

53 SOAP Publish SOAP Service Consumer Client Service Provider Service UDDI WSDL Legend request flow reply flow program boundary module boundary Service Description

54 Agenda Homework Web Services XML SOAP WSDL UDDI Conclusion

55 Web service concerns New Standard Quality of service Royalty fees? Slow (XML parsing)

56 Summary Web Services –A web service is a piece of software that is made available on the Internet and utilizes a standardized XML messaging system. –A web service can contain: A public interface (WSDL) A publishing and discovery process (UDDI)

57 Summary (2) UDDI –Universal Description, Discovery, and Integration –Process for business to find web services of potential business partners without random discovery. –UDDI is: A business registry containing relevant information such as: –General business information (name, description, etc.) –Business’ Web services (description, invocation methods, etc.) Methods to query and publish to the registry via SOAP messages.

58 Summary (3) WSDL –Web Service Description Language –XML Base Language for describing web services and how to access them –WSDL describes: Interface information describing all publicly available functions Data type declarations for all message requests and responses Binding information about the transport protocol Address information for locating the service

59 References UDDI: http://www.uddi.org/ http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicef aqs.html?page=3 http://www.learnxmlws.com/tutors/uddi/uddi.aspx http://www.xml.com/lpt/a/2001/04/04/webservices/index.html http://www.javaworld.com/javaworld/jw-08-2001/jw-0824-uddi.html http://developer.java.sun.com/developer/technicalArticles/WebService s/WSPack http://www.uddi4j.org http://www.xmlmodeling.com/examples/uddi/ModelingUDDI.pdf

60 References WSDL: O’Reilly & Associates – Web Services Essentials by Ethan Cerami http://www.oreillynet.com/pub/a/webservices/2002/02/12/webservicef aqs.html http://msdn.microsoft.com/library/?url=/library/en- us/dnwebsrv/html/wsdlexplained.asp?frame=true http://dcb.sun.com/practices/webservices/overviews/overview_wsdl.js p

61 Acknowledgement Rob Pearson And Ed Loo Madhu Siddalingaiah


Download ppt "COP 4991 Component Based Software Development Lecture #3 Web Services Onyeka Ezenwoye."

Similar presentations


Ads by Google