Presentation 7: Web Services Introduced
Ingeniørhøjskolen i Århus Slide 2 af 44 Outline Overview of Web Services & SOAP Service-Oriented Architecture –Service Description –Service Registration and Discovery –Service Execution Emerging Web Services standards: SOAP, WSDL, UDDI (introduced)
Ingeniørhøjskolen i Århus Slide 3 af 44 Web Service Defined W3C definition: –[Definition: A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.]
Ingeniørhøjskolen i Århus Slide 4 af 44 Overview SOAP & Web services SOAP – Simple Object Access Protocol - & Web services: –A light-weight & ultra heterogenic alternative to CORBA, DCOM & RMI –Openness in focus – meant for opening legacy applications for others –Not meant in the role of Inter business, large scale, transaction heavy communication (as CORBA & J2EE) –But can prob. be used for it! –Does not have services for transactions, concurrency, persistence, scalability –Does have discovery services (UDDI) giving some degree of location transparency –Does have Interface Definition Language for heterogeneity (WSDL) –Fails on several of the dist. system requirements! –But easy to implement yourself!
Ingeniørhøjskolen i Århus Slide 5 af 44 Why SOAP When We Have CORBA? CORBA has been considered too complex by many –May not be true with new development tools using wizards They aim at solving different tasks: –SOAP covers light-weight application integration within the enterprise, exposing legacy business objects across enterprises, and sharing resources (like Google Search Engine, or Sonofon SMS/MMS API) on the net, as well as technology openness –CORBA has a wide range of services for (as we shall see later): Locating, creating & moving objects Object relationship management between hosts Persistency services – activation frameworks etc. Distributed concurrency and transaction management Security –Only some are supported in SOAP tech family – its lightweight –Lesson: define your needs – and find the right technology
Ingeniørhøjskolen i Århus Slide 6 af 44 Regarding SOAP SOAP is not by it self revolutionary – its merely: –a framework for exchanging XML-based information in a network (via protocols of the TCP/IP family) – with RPC capabilities –the currently most hyped XML / Web service technology But when combined with other technologies like –WSDL & –UDDI –It solves several of the requirements of a Distributed System And the fact that it is an open standard – supported by all major software vendors and programming languages: –C++ –Java –C# –Delphi –Visual Basic and many more Makes it somewhat revolutionary! A practical solution – like WWW
Ingeniørhøjskolen i Århus Slide 7 af 44 Overview SOAP & Web services SOAP – Simple Object Access Protocol - & Web services: –A light-weight & ultra heterogenic alternative to CORBA, DCOM & RMI –Openness in focus – meant for opening legacy applications for others –Not meant in the role of Inter business, large scale, transaction heavy communication (as CORBA & J2EE) –No services for transactions, concurrency, persistence, scalability –Discovery services (UDDI) giving some degree of location transparency –Interface Definition Language for heterogeneity (WSDL) –Fails on several of the dist. system requirements! –But easy to implement yourself!
Ingeniørhøjskolen i Århus Slide 8 af 44 Why SOAP When We Have CORBA? CORBA has been considered too complex by many –May not be true with new development tools using wizards They aim at solving different tasks: –SOAP covers light-weight application integration within the enterprise, exposing legacy business objects across enterprises, and sharing resources (like Google Search Engine, or Sonofon SMS/MMS API) on the net, as well as technology openness –CORBA has a wide range of services for (as we have seen): Locating, creating & moving objects Object relationship management between hosts Persistency services – activation frameworks etc. Distributed concurrency and transaction management Security –Only some are supported in SOAP tech family – its lightweight –Lesson: define your needs – and find the right technology
Ingeniørhøjskolen i Århus Slide 9 af 44 Regarding SOAP SOAP is not by it self revolutionary – its merely: –a framework for exchanging XML-based information in a network (via protocols of the TCP/IP family) – with RPC capabilities –the currently most hyped XML / Web service technology But when combined with other technologies like –WSDL & –UDDI –It solves several of the requirements of a Distributed System And the fact that it is an open standard – supported by all major software vendors and programming languages: –C++ –Java –C# –Delphi –Visual Basic and many more Makes it somewhat revolutionary! A practical solution – like WWW
Ingeniørhøjskolen i Århus Slide 10 af 44 Examples of Web Services Google's Web Service - access the Google search engineGoogle's Web Service – Amazon's Web Service - access Amazon's product informationAmazon's Web Service – per/resources.html XMethods - collection of information about existing Web servicesXMethods – SalCentral - WSDL / SOAP Web services search-engineSalCentral –
Ingeniørhøjskolen i Århus Slide 11 af 44 Google Web Service
Ingeniørhøjskolen i Århus Slide 12 af 44 Service-Oriented Architecture (SOA) Client Server Registry Abstract Architecture - Web service stack Abstract Architecture - Web service stack Legacy code on server Legacy code on server Opening up for doing business (the sharing of objects) on the Internet
Ingeniørhøjskolen i Århus Slide 13 af 44 Technologies for Implementing SOA SOAP for communication WSDL for contract & binding UDDI & WSDL for registration & discovery
Ingeniørhøjskolen i Århus Slide 14 af 44 What is SOAP? Simple Object Access Protocol Wire protocol similar to –IIOP for CORBA –JRMP for RMI XML is used for data encoding –“text” based protocol vs. “binary” protocol Supports XML-based RPC
Ingeniørhøjskolen i Århus Slide 15 af 44 What is Not SOAP? Not a component model –So it will not replace objects and components, i.e. EJB, JavaBeans and.NET Not a programming language –So it will not replace Java, C# og C++ Not a solution for all –So it will not replace other distributed computing technologies such as RMI and CORBA
Ingeniørhøjskolen i Århus Slide 16 af 44 Where is SOAP? W3C XML Protocol working group –SOAP 1.2 current version: Microsoft, SUN, Oracle, HP, IBM all support the W3C recommendation –but there are still differences to be overcome –security issues, transactions etc.
Ingeniørhøjskolen i Århus Slide 17 af 44 What does SOAP define? Message Envelope Encoding Rules RPC Convention Binding with underlying protocols –HTTP (which we will use in this course) –SMTP –FTP and others
Ingeniørhøjskolen i Århus Slide 18 af 44 SOAP Message Format Possible to Attach binaries (images, cryptographic material) to attachments
Ingeniørhøjskolen i Århus Slide 19 af 44 SOAP Message Envelope Encoding information Header –Optional –Could contain context knowledge Security Transaction Body –RPC methods and parameters –Contains application data
Ingeniørhøjskolen i Århus Slide 20 af 44 Two types of communication
Ingeniørhøjskolen i Århus Slide 21 af 44 SOAP RPC Request Example <SOAP-ENV:Envelope xmlns:SOAP-ENV="…" SOAP-ENV:encodingStyle="…"> SUNW
Ingeniørhøjskolen i Århus Slide 22 af 44 SOAP RPC Response Example <SOAP-ENV:Envelope xmlns:SOAP-ENV="…" SOAP-ENV:encodingStyle="…"> 30.5
Ingeniørhøjskolen i Århus Slide 23 af 44 SOAP RPC composition I Information needed for a method call: 1.The URI of the target object (marked with red) SUNW
Ingeniørhøjskolen i Århus Slide 24 af 44 SOAP RPC composition II Information needed for a method call: 1.The URI of the target object 2.The Method Name SUNW
Ingeniørhøjskolen i Århus Slide 25 af 44 SOAP RPC composition III Information needed for a method call: 1.The URI of the target object 2.The Method Name 3.Parameters 4.Binding protocol (next slide) SUNW Name is not important
Ingeniørhøjskolen i Århus Slide 26 af 44 SOAP RPC composition IV: complete SOAP RPC Request POST /StockQuote HTTP/1.1 Host: Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" <SOAP-ENV:Envelope xmlns:SOAP-ENV=” SOAP-ENV:encodingStyle=” SUNW HTTP Encoding Name- space STEP 4: BINDING TO PROTOCOL
Ingeniørhøjskolen i Århus Slide 27 af 44 Request to HelloWorld.jws Input parameters type string HTTP Post Call HTTP Host Target Method name
Ingeniørhøjskolen i Århus Slide 28 af 44 … and the HTTP Response from Server HTTP Response Method Response Parameter value Parameter name Apache Tomcat Server Responding
Ingeniørhøjskolen i Århus Slide 29 af 44 Issues with SOAP –Lack of business semantics –Insufficient functionality for business operations –Security –Reliability –Under development Low performance
Ingeniørhøjskolen i Århus Slide 30 af 44 WSDL WSDL is used for describing WebServices
Ingeniørhøjskolen i Århus Slide 31 af 44 What is WSDL? XML language for describing web services Web service is described as – A set of communication endpoints (ports) Endpoint is made of –Abstract definitions of operations and messages –Concrete binding to networking protocol and message format
Ingeniørhøjskolen i Århus Slide 32 af 44 Why WSDL? Enables automation of communication details between communicating partners –Machines can read WSDL –Machines can invoke a service defined in WSDL Note that WSDL defines only low-level aspects of Web services, however other technologies might follow … –Security –Transactions –Persistency
Ingeniørhøjskolen i Århus Slide 33 af 44 WSDL Document Example Simple service providing stock quotes A single operation called GetLastTradePrice Deployed using SOAP 1.1 over HTTP Request takes a ticker symbol of type string Response returns price as a float
Ingeniørhøjskolen i Århus Slide 34 af 44 WSDL Elements Types –Data type definitions –Used to describe exchanged messages –Uses W3C XML Schema as canonical type system
Ingeniørhøjskolen i Århus Slide 35 af 44 WSDL Elements Messages –Abstract, typed definitions of data being exchanged Operations –Abstract description of an action –Refers to input and output messages Port type –Collection of operations –Resembles a Class in OOPL
Ingeniørhøjskolen i Århus Slide 36 af 44 WSDL Elements Binding –Concrete protocol and data format for a particular Port type –Example: SOAP 1.1, HTTP, MIME Port –Defines a single communication endpoint –Address for binding –URL for HTTP, address for SMTP Service –Aggregate set of related ports
Ingeniørhøjskolen i Århus Slide 37 af 44 HelloWorld.jws?wsdl
Ingeniørhøjskolen i Århus Slide 38 af 44 Tools Generate WSDL document from –existing Java classes or EJB components –AXIS: Java2WSDL Generate SOAP messages from –WSDL document (via client stub and server skeleton) JAX-RPC –Part of J2EE from Sun (needs AS) IDE Tools: –NetBeans, Eclipse, Forte for Java, JBuilder, JDeveloper Microsoft: –IIS for services and Visual Studio for IDE
Ingeniørhøjskolen i Århus Slide 39 af 44 UDDI UDDI for publishing & discovery – the SOA
Ingeniørhøjskolen i Århus Slide 40 af 44 UDDI Universel Descrition, Discovery & Integration UDDI defines a scheme to publish and discover information about Webservices Programmatic registration and discovery business entities and their Webservices Based on SOAP, HTTP, XML Registry data –Business registrations –Service type definitions
Ingeniørhøjskolen i Århus Slide 41 af 44 Registration “ White pages” – Address, contact, and known identifiers “ Yellow pages” –industrial categorizations –Industry: NAICS (Industry codes - US Govt.) –Product/Services: UN/SPSC (ECMA) –Location: Geographical taxonomy “ Green pages” –technical information about services
Ingeniørhøjskolen i Århus Slide 42 af 44 What uses UDDI? Tool building client (Service Consumer) –Browse or search registry –Create a service proxy Tool publishing the service –Generates WSDL –Construct UDDI entries Application that needs dynamic binding –Directly access UDDI –Query can be pre-generated