Berner Fachhochschule Technik und Informatik Web Services An Introduction Prof. Dr. Eric Dubuis Berner Fachhochschule Biel
Overview Web Service versus Web Application A Definition for the Term Web Service Historical View Web Service Standards Realization of a Web Service Basic XML knowledge (XML, XML schema, XML namespaces) is assumed 01/29/08 Web Services Introduction 2
Web Service versus Web Application Client/Server Application Client Server Client application protocol Server application data formats 01/29/08 Web Services Introduction 3
Web Service versus Web Application Web Application Client Server Web browser HTTP Web server Presentation HTML documents HTTP: HTML: Hypertext Transfer Protocol Hypertext Markup Language 01/29/08 Web Services Introduction 4
Web Service versus Web Application Web Service Client Server Verarbeitung Service consumer HTTP SOAP Web Server Web service provider XML data SOAP: XML: used to be: Simple Object Access Protocol Extensible Markup Language 01/29/08 Web Services Introduction 5
A Definition of Web Service Web services is a technology that allows applications to communicate with each other in a platform- and programming language-independent manner. A Web service is a software interface that describes a collection of operations that can be accessed over the network through standardized XML messaging. It uses protocols based on the XML language to describe an operation to execute or data to exchange with another Web service. A group of Web services interacting together in this manner defines a particular Web service application in a Service- Oriented Architecture (SOA). (IBM, http://www-128.ibm.com/developerworks/webservices/newto/websvc.html? S_TACT=105AGX28&S_CMP=DLMAIN) 01/29/08 Web Services Introduction 6
Historical View Since 1980: Internet Network of computers (TCP/IP) Since 1990: World Wide Web Network of documents (HTTP/HTML) Since 2000: Web Services Network of applications (SOAP/XML SOA) 01/29/08 Web Services Introduction 7
Historical View Why Web Services? Calling of remote applications via the Internet / World Wide Web (through firewalls) Asynchronous exchange of documents (and synchronous execution of remote operations) Application of standardized, XML-based protocols and data formats Platform-independence and support of many IT companies 01/29/08 Web Services Introduction 8
Historical View Application Scenarios Integration of applications within a company (enterprise application integration EAI) Provision of services for customers (business to customer B2C) Electronic exchange of data between companies (business to business B2B) Electronic exchange of data between governmental agencies (e-government) Electronic exchange of data between health agencies (e-health)... 01/29/08 Web Services Introduction 9
Overview on Web Services Standards Service Oriented Architecture (SOA) UDDI Service Registry lookup WSDL publish Service Requestor call / use SOAP Service Provider 01/29/08 Web Services Introduction 10
Web Services Standards Illustrated SOAP defines the structure of an XML message to be sent to a Web service HTTP Wrapper SOAP Envelope SOAP Header SOAP Body 01/29/08 Web Services Introduction 11
Web Services Standards Illustrated Example of a SOAP Message POST /MasterFilesWebService/MasterFiles.asmx HTTP/1.0 Content-Type: text/xml; charset=utf-8 Host: corpus.bfh.ch:80 <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelop e/"> <soap:body> <ReadCustomsOffices xmlns="http://eetna.bfh.ch/masterfiles/"/> </soap:body> </soap:envelope> 01/29/08 Web Services Introduction 12
Web Services Standards Illustrated Web Services Description Language (WSDL) Web Services Description Language [...] provides a model and an XML format for describing Web services. WSDL [...] enables one to separate the description of the abstract functionality offered by a service from concrete details of a service description such as how and where that functionality is offered. (W3C, http://www.w3.org/tr/2007/pr-wsdl20-20070523/) Port Type Service Operation Binding Port Message How? Where? What? 01/29/08 Web Services Introduction 13
Web Services Standards Illustrated Structure of a WSDL Document <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"> <import.../> <types>data formats</types> <message>message structure</message>... <porttype>operations of the service</porttype> <binding>protocol binding</binding> <service>address of the service</service> </definitions> 01/29/08 Web Services Introduction 14
Web Services Standards Illustrated Universal Description, Discovery, Integration (UDDI) The UDDI registry permits to add, to group, and to look up a Web service Web Portal Service Client UDDI Registry 01/29/08 Web Services Introduction 15
Web Service Standard Zoo Standard Organizations W3C (www.w3.org) XML, SOAP, WSDL XML-Signature, XML-Encryption OASIS (www.oasis-open.org) UDDI, ebxml (Electronic Business using XML) SAML, WSS (Web Services Security) ITU (www.itu.org) X.509 Certificates WS-I (www.ws-i.org) Interoperability Profile 01/29/08 Web Services Introduction 16
Web Service Standard Zoo (an Excerpt) * Bootstrapping o WS-MetadataExchange * Reliable Messaging o WS-ReliableMessaging o WS-ReliableMessaging Policy * Atomic Transactions o WS-Atomic Transaction o WS-Coordination * Security o WS-Security o WS-SecurityPolicy o WS-Trust o WS-SecureConversation * Policy (used to configure the above) o WS-Policy o WS-PolicyAttachment... 01/29/08 Web Services Introduction 17
Realization of a Web Service Software Architecture A Web service is often realized by using a multi-tier architecture Web tier Business tier Data tier Web application Web service Business objects Data access reusability 01/29/08 Web Services Introduction 18
Realization of a Web Service Technical Architecture Stubs and skeletons are auxiliary objects that convert parameters or return values in method calls to SOAP messages and vice versa. Service consumer Service Client WSDL Service provider Service Implementation Mapping Java C# Mapping Stub SOAP Interoperability Skeleton 01/29/08 Web Services Introduction 19
Realization of a Web Service Code first versus Contract first Code first WSDL is generated from an existing implementation Advantage: simple and fast realization Contract first WSDL is created first, and the Web service is implemented thereafter Advantage: changes of good interoperability 01/29/08 Web Services Introduction 20