8a Web Services all slides PDF
Document Details
Uploaded by SmilingHibiscus5596
Université de Fribourg
2024
AS 2024
Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater
Tags
Related
- Cours 3 : Les Services Web - Définition et Architecture - PDF
- Stateful vs Stateless Architecture PDF
- Appunti TPS PDF
- Web Service Development - WAT 2140C Module Information Pack PDF
- BSc (Hons) Software Engineering Web Service Development PDF
- BSc (Hons) Software Engineering - Web Service Development Past Paper PDF - University of Technology, Mauritius 2024
Summary
This document is a past paper from the course Advanced Software Engineering/Internet Applications, AS 2024. It covers topics including Web Services Overview, RESTful Services, Service Description, Service Discovery, Service Communication, Service Composition, Node-RED, and Service Middleware.
Full Transcript
Advanced Software Engineering Internet Applications 2. Web Services Advanced Software Engineering /Internet Applications 1/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jü...
Advanced Software Engineering Internet Applications 2. Web Services Advanced Software Engineering /Internet Applications 1/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel1/7 Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 2/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Recap: Internet Applications The Internet is THE infrastructure for distributed applications - e.g., social software So far we had a rather simplified view of distributed applications - a few components running on a handful of computers - connected via simple application layer prootcols PC running Browser Server running Apache Web server Mac running Browser Advanced Software Engineering /Internet Applications 3/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel But in Reality... Advanced Software Engineering /Internet Applications 4/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Software Engineering and Complexity Internet applications can become large and complex - e.g., ERP with SCM and CRM So which software methods can help us deal with it ? - Design Patterns - for architecture or implementation details - Decoupling - e.g. via layered architecture - Decomposition / Reuse / Outsourcing - e.g., via generalized components (-> abstraction) with simple interfaces or via standardized components from 3rd party providers The service paradigm or SOA is well indicated to implement on a concrete basis these methods. Advanced Software Engineering /Internet Applications 5/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel So What Is a Service – 1 ? While people tend to have a common understanding of what makes a product there is little agreement about the definition of ”service” “…intangible, perishable, experiential, and co-produced between customers and providers…” “…service is a special form of (intangible) good …” “…service is a process using one's competencies for the benefit of another party …” Advanced Software Engineering /Internet Applications 6/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel So What Is a Service – 2 ? Service in Economics business activity that often results in intangible outcomes or benefits the non-material equivalent of a good. Service provision has been defined as an economic activity that does not result in ownership, and this is what differentiates it from providing physical goods. process that creates benefits by facilitating either a change in customers, a change in their physical possessions, or a change in their intangible assets. Service in Computer Science a certain functionality that is provided by an agent (in the sense of autonomous piece of software), who can be reached at a certain location at certain times, and that is triggered by an event Advanced Software Engineering /Internet Applications 7/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Single Web Service programmatically available application logic exposed over the Internet - any piece of code and any application component deployed on a system can be transformed into a network-available service performs encapsulated business function, for example : - self-contained business task – a funds withdrawal service - full-fledged business process – automated purchasing of office supplies - application – life insurance application - service-enabled resource – access to a particular database available to a variety of clients (platform independent) enables new business models - e.g., pricing options based on subscription or pay per use to address different target markets Advanced Software Engineering /Internet Applications 8/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Web Services Ecosystem support the rapid, low-cost composition of distributed applications - reflect a new ‘service-oriented’ approach to programming - based on the idea of composing applications by discovering and invoking network-available services rather than building new applications can be mixed and matched to create a complete process - integration with human interaction - supply chain management - for new applications or extensions to existing applications Advanced Software Engineering /Internet Applications 9/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Examples: Amazon – S3 & EC2 Data as a Service Amazon Simple Storage Service (S3) - Write and read objects up to 5GB - x cents GB / month to store - y cents GB / month to transfer Computing as a Service Amazon Elastic Compute Cloud (EC2) - allows customers to rent computers - on which to run their own computer applications - virtual server technology - z cents / hour Advanced Software Engineering /Internet Applications 10/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service Reuse and Composition Advanced Software Engineering /Internet Applications 11/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Example: Purchase Order Application Advanced Software Engineering /Internet Applications 12/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Where Are Web Services Used? 1. Within an enterprise (enterprise application integration) - Accelerate and reduce the cost of integration - Improve reuse - Save on infrastructure deployment and management costs - Reduce skill requirements 2. Between enterprises (e-Business integration) - Providing service to a company’s customers - e.g., an Insurance company wishes to link its systems to the systems of a new institutional customer - Accessing services from a company’s partners and suppliers - e.g., dynamically link to new partners and suppliers to offer their services to complement the value the company provides Advanced Software Engineering /Internet Applications 13/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Some Important Aspects of WS Loose Coupling - Coupling indicates the degree of dependency any two systems have on each other. - Web services are loosely coupled: they connect and interact more freely (across the Internet). They need not know how their partner applications behave or are implemented. Service Granularity - Simple services are discrete in nature, exhibit normally a request/reply mode of operation and are of fine granularity, i.e., they are atomic in nature. - Complex services are coarse-grained, e.g., SubmitPurchaseOrder process - interactions with other services and possibly end-users Advanced Software Engineering /Internet Applications 14/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service-Oriented Architecture (SOA) Standard Roles Points to Description UDDI WSDL consumer Registry provider registry Points to Service Describes Finds WS Tasks Service Services describe discover select Service Web SOAP Consumer Service communicate mediate Communicate with Service Provider execute XML Messages monitor A SOA is compose a logical way of designing a software system to provide services to applications or other services distributed in a network Advanced Software Engineering /Internet Applications 15/96 2024via AS published – Prof. and/ discoverable Jacques Pasquier Dr. Mourad Kayati / interfaces. Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Consumer vs. Provider Perspective Consumer Provider How to build it? What does it Service do? Interface Implementation How to represent it? How do I use it? How to publish Where to host Where can I it? it? find it? Interface defines service functionality visible to the external world and provides the means to access this functionality. operations available, the parameters, data-typing and the access protocols Implementation using any programming language Advanced Software Engineering /Internet Applications 16/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service Deployment and Realisation Advanced Software Engineering /Internet Applications 17/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS Development Lifecycle identify, conceptualize, and rationalize business processes as a set of interacting services Analysis Implementation implementation and develop in-depth understanding and testing in selected of functionality, scope, reuse, and Testing and granularity of candidate Design programming language and development business processes and services. environment design for reuse, for compo- sition, and for granularity Specification: structural, behavioral, service Execution programming style, and and Provisioning policy. Monitoring SOA governance refers to the organization, load balancing / service process, policies, and migration (service cloud) Deployment metrics that are monitor service consumption required to manage an Publish the service interface SOA successfully. (for billing), performance (for QoS), … and service description Deploy the Web service Advanced Software Engineering /Internet Applications 18/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 19/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel RESTful Services Representational State Transfer (REST) Services Web API: Web as a computational platform Simple service provisioning and consumption Basic idea: transfer (state of) resources Success story as part of Web 2.0: programmable web, (end user) mashups Example: HousingMaps.com mashup by Craigslist and Google Maps services Craigslist: free online classified advertisements – with sections devoted to jobs, housing, personals, for sale, services, community, gigs, résumés, and discussion forums. Advanced Software Engineering /Internet Applications 20/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Resources & State Transfer Data is organized in the form of resources - referenced via global identifier (URI) Service Provider and Consumer communicate via HTTP - exchange representations of these resources (the actual documents conveying the information). Example GET http://www.myrestservice.ch/persons Returns a list of available persons GET http://www.myrestservice.ch/persons/{name} Returns the representation of the person with the corresponding name Advanced Software Engineering /Internet Applications 21/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel RESTful Communication: HTTP HTTP Methods ("CRUD") HTTP Responses GET retrieves a resource 200 ok POST creates a resource 201 ok, created (may return URI) PUT (PATCH) updates a resource 400 error, bad request 404 error, resource not found DELETE deletes a resource In practice, GET is often misused to call methods GET /adduser?name=Robert HTTP/1.1 But should really be POST POST /users HTTP/1.1 Host: myserver affected Content-Type: application/xml resource state of resource Robert Then the resource “Robert” can be retrieved GET /users/Robert HTTP/1.1 Host: myserver Accept: application/xml Advanced Software Engineering /Internet Applications 22/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Principles – 1 Any number of connectors (e.g., clients, servers, caches, tunnels, etc.) can mediate the request - an application can interact with a resource by knowing two things: the identifier of the resource and the action required - no need to know whether there are caches, proxies, gateways, firewalls, tunnels, or anything else between it and the resource The application needs to understand the format of the information (representation) returned. Stateless communication - Resources are conversationally stateless - Any conversational state is held in the client. - Scalability, reliability - No client context being stored on the server between requests. - Each request from any client contains all of the information necessary to service the request. Advanced Software Engineering /Internet Applications 23/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Principles – 2 Caching - Efficiency, scalability - Well-managed caching partially or completely eliminates some client- server interactions, further improving scalability and performance. - Consistency issues - As on the World Wide Web, clients are able to cache responses. Responses must therefore, implicitly or explicitly, define themselves as cacheable or not, to prevent clients reusing stale or inappropriate data in response to further requests. Code-on-demand - Extending client functionality - Servers are able to temporarily extend or customize the functionality of a client by transferring to it logic that it can execute. Examples of this may include compiled components such as Java applets and client-side scripts such as JavaScript. Advanced Software Engineering /Internet Applications 24/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Principles – 3 A very good (although not too recent) book is the one called RESTful Web Services : Web services for the real World By Leonard Richardson and Sam Ruby http://shop.oreilly.com/product/9780596529260.do It contains useful information on how to design ROA and what makes it different (often better) than big SOAP web services. The whole discussion is very well summarized in (you must read it !) : http://martinfowler.com/articles/richardsonMaturityModel.html Advanced Software Engineering /Internet Applications 25/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 26/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS Description Web Services Description Language WSDL: foundation for a family of WS standards known as WS-* (as opposed to RESTful ones, which are more lightweight) Web services must be defined in a consistent manner to be discovered and used by other services and applications. Standardized Service description - is a machine-understandable standard, describing the operations of a Web service. - specifies the wire format and transport protocol that the Web service uses to expose this functionality. - can also describe the payload data using a type system. Service description + SOA infrastructure - isolates all technical details, e.g., machine- and implementation language-specific elements, away from the service requestor’s application and the service provider’s Web service. Advanced Software Engineering /Internet Applications 27/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS Description Aspects Base Language - e.g., XML : common meta-language used as a basis to specify all the languages necessary to describe the different aspects of a service. Interface - service name and parameters (data types) - service endpoint (URI) and transport protocol (e.g., HTTP) - WSDL based on XML Properties and Semantics - non-functional properties (cost, reputation, quality) and textual descriptions may be crucial in deciding about the service usage - Universal Description, Discovery and Integration (UDDI) for building repositories and organizing information about Web services. - QoS and SLAs for formalizing service behaviour , e.g., for legal contracts Business Protocol - conversation = seq of operations that a client invokes to achieve a goal - business protocol = rules for conversations - Web Services Conversation Language (WSCL) - Business Process Execution Language for Web Services (BPEL4WS) Advanced Software Engineering /Internet Applications 28/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WSDL Web Service Description Language Current version: 2.0 @ W3C (formerly known as 1.2) - Version 1.1 still in widespread use XML Document WSDL 2.0 Elements Abstract ‒ (Data) Types: defines data types in XML Schema for all data exchanged ‒ Interface: defines a set of operations complete with input and output data types Concrete ‒ Binding: defines application layer protocols and From Wikipedia message exchange pattern ‒ e.g., SOAP over HTTP using RPC style messaging ‒ Service and Endpoint: defines the address (URI – "endpoint") under which the service offers the operations defined via the referenced interface All elements are reusable ("define once, use multiple times"). Advanced Software Engineering /Internet Applications 29/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WSDL as a Contract A Web service description in WSDL is an XML document that describes the mechanics of interacting with a particular Web service. WSDL represents a “contract” (in the form of syntax and some semantics) between the service requestor and the service provider WSDL is platform and language independent WSDL describes - what a service does, i.e., the operations the service provides, - where it resides, i.e., details of the protocol-specific address, e.g., a URL, - how to invoke it, i.e., details of the data formats and protocols necessary to access the service’s operations. Advanced Software Engineering /Internet Applications 30/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WSDL Service A logical node of the application One interface Multiple alternate endpoints Endpoints may have different bindings - e.g. SOAP over HTTPS for a public endpoint, and SOAP over HTTP for the Intranet Advanced Software Engineering /Internet Applications 31/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS Endpoints (Calculator example with SoapUI Not in version 2.0 Advanced Software Engineering /Internet Applications 32/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Quality of Service (QoS) QoS refers to the ability of a Web service to respond to expected invocations and perform them at the level expected by both its provider and its customers. The key QoS in a Web services environment are: - availability - accessibility - conformance to standards - integrity - performance - reliability - scalability - security - transactionality Advanced Software Engineering /Internet Applications 33/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service Level Agreements (SLAs) SLA is a formal agreement (contract) between a provider and client, formalizing the details of use of a Web service (contents, price, delivery process, acceptance and quality criteria, penalties, etc in measurable terms) in a way that meets the mutual understandings and expectations of both providers and clients. SLA may contain - purpose - parties - validity period - scope - restrictions - service-level objectives - penalties - exclusion terms - administration authority. Advanced Software Engineering /Internet Applications 34/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel And RESTful Services? Advanced Software Engineering /Internet Applications 35/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Interface RESTful = communication by resource (data) exchange 5 predefined methods for : create, read, update , and delete (CRUD) resource referencing - URI, often hierarchical (tree) resource organization http://www.myservice.org/discussion/{topic}/{author} resource encoding - XML crap - JSON (JavaScript Object Notation) {"firstName":"John", "lastName":"Smith", "age":25} WSDL-like def. language for describing RESTful services: http://raml.org (RESTful API Modeling Language) https://www.openapis.org (ex Swagger) http://Apigee.com (a platform to manage REST API with qualities) Advanced Software Engineering /Internet Applications 36/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Interface: JSON { "firstName": "John", "lastName": "Smith", "age": 25, JavaScript Object Notation (JSON) "address": { "streetAddress": "21 2nd Street", - A lightweight computer data "city": "New York", interchange format. "state": "NY", "postalCode": "10021" - Specified in Request For Comment } RFC 4627 } - Used by a growing number of services Represents a simple alternative to XML - A text-based, human-readable format for representing simple data structures and associative arrays (called objects). - No namespaces, attributes etc. - No schema language (for description, verification) JavaScript-friendly notation - A serialized object or array - One of its main application is in AJAX Web application programming Advanced Software Engineering /Internet Applications 37/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST vs. WS-* WS-* A SOAP service (WS-*) has a single endpoint that listEntries() handles all the operations addEntry() – therefore it has to have getEntry() collection an application-specific deleteEntry() service interface. updateEntry() RESTful A RESTful service has a listEntries() number of resources (the collection collection, each entry), so updateEntries() the operations can be getEntry() distributed onto the deleteEntry() resources and mapped to addEntry() entry a small uniform set of updateEntry() entry operations. entry Advanced Software Engineering /Internet Applications 38/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 39/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS-* Service Discovery Task find a particular service among a large collection of services and providers Service Discovery via Registry client does not necessarily need to know service descriptions are stored in a which provider offers the service service directory - providers may register new services - consumers may search services Service (2) Query for all discovery can be done at matching services in (3) Discovery theregistry results Registry registry - design-time – identifying the most (1) Registration request for relevant services service description - run-time – using dynamic binding (4) Request directory can be managed and hosted for selected (5) Service service information information of by selected service PUBLISH - trusted third party - internal company solution. (6) Invocation request SEARCH Interaction with the directory service: including possible inputs UDDI specification defines standard INVOKE Service ServiceE-service provider provider provider APIs for publishing and discovering info Service (7) Invocation results Service requester in service directories. requestor Advanced Software Engineering /Internet Applications 40/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Universal Description, Discovery, and Integration UDDI features - describe providers and its services - discover providers that offer desired services - integrate (interoperate) with these UDDI business registration - “white pages” (address, contact, and other key points of contact) - “yellow pages” classification info based on standard industry taxonomies - “green pages”, the technical capabilities and information about services BUT: As of 2006 major UDDI service providers (IBM, Microsoft, SAP) have discontinued the support for their public UDDI registries. Advanced Software Engineering /Internet Applications 41/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Alternative to Registries: WS Search Engines Search Engine for Web Services - services are found by automated crawling process - information from multiple sources can be aggregated into a service description - service descriptions are stored in an index - search by matching keywords with index Service 6. Call Service Service Provider Service Provider Provider 1. Crawls 5. Select Service Service 4. Services Consumer Result List 2. Store WS Search Service URL 3. Search Engine & Description Request WS Index 4. Retrieve Services Advanced Software Engineering /Internet Applications 42/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Discovery: Registries – 1 (deprecated since end 2022) https://www.programmableweb.com Advanced Software Engineering /Internet Applications 43/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel REST Discovery: Registries – 2 (last visit October 2024) https://www.opendatanetwork.com Follow the link and scroll-down => Advanced Software Engineering /Internet Applications 44/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 45/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel RESTful Communication: HTTP HTTP Methods HTTP Responses GET retrieves a resource 200 ok POST creates a resource 201 ok, created (may return URI) 400 error, bad request PUT / PATCH updates a resource 404 error, resource not found DELETE deletes a resource In practice, GET is often misused to call methods GET /adduser?name=Robert HTTP/1.1 But should be POST POST /users HTTP/1.1 affected Host: myserver resource Content-Type: application/xml state of Robert resource Then the resource “Robert” can be retrieved GET /users/Robert HTTP/1.1 Host: myserver Accept: application/xml Advanced Software Engineering /Internet Applications 46/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel WS-* Communication: SOAP SOAP: Simple Object Access Protocol - but is in in fact a simple messaging protocol - current version: 1.2 @ W3C - is the standard messaging protocol used by WS-* Web services - uses mostly HTTP as transport protocol - uses XML as an encoding scheme for request and response Service consumer Service provider Application object Application object (client) (service provider) SOAP-based SOAP-based middleware middleware SOAP messages exchanged on top of, HTTP, SMTP, or other transport Converts procedure calls to/from XML messages sent through HTTP or other protocols. Advanced Software Engineering /Internet Applications 47/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel SOAP SOAP covers message format using XML documents description of how a SOAP message should be transported using HTTP (for Web- based interaction) or SMTP (for e-mail-based interaction). set of rules for processing SOAP messages conventions on how to turn an RPC call into a SOAP message and back. Advanced Software Engineering /Internet Applications 48/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Topics 1. Web Services Overview 2. RESTful Services (revisited) 3. Service Description 4. Service Discovery 5. Service Communication 6. Service Composition 7. Node-RED 8. Service Middleware Advanced Software Engineering /Internet Applications 49/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service Composition and Reusability Consider the following three food Order Order Eat Pay services Traditional Restaurant Order Eat Pay Fast Food Order Pay Eat Buffet Pay Eat Sit Down Buffet Pay Order Eat Home Food Party Eat Order Pay Soup kitchen Eat Reusable business processes allow the same 3 services, assembled differently to support 6 different business processes Advanced Software Engineering /Internet Applications 50/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Business Processes Business Process is a set of logically related tasks performed to achieve a well- defined business outcome defines the results to be achieved, the context of the activities, the relationships between the activities & the interactions with other processes and resources. has a duration that may vary may contain automated and manual activities is widely distributed is dynamic and usually long running defines data and control flow - sequential and parallel execution with conditions Advanced Software Engineering /Internet Applications 51/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Business Process Management (BPM) BPM Aspects modelling/design, simulation, and analysis - document, understand, and improve business processes integration - seamless data exchange between process elements deployment and execution - automate the execution of processes while enforcing rules monitoring - status und performance measurements - archiving and analysis of execution logs Overall goal: process optimizations against different KPIs (e.g., costs) Advanced Software Engineering /Internet Applications 52/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Web Services and Business Processes building composite services by combining existing services traditionally coding of composite WS by programming languages (Java etc) - these languages have not been designed for WS composition - implementation requires attention to low-level details (data conversions, preparing SOAP payload, browsing through WS registries, managing concurrent conversations, handling exceptions, etc.) - business logic and low-level details are intermingled in the code improvement by higher-level programming models Web service composition allows definition of increasingly complex applications by subsequently aggregating WS composition is based on interfaces describing the functionality, while the components remain separated from the composite service - coordinating the flow of control and data - business logic sequence coordinates and manages interactions See videos at https://www.activiti.org (the one by Alfresco is quite interesting) Advanced Software Engineering /Internet Applications 53/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Orchestration vs. Choreography Orchestration Choreography describes how Web tracks the sequence of services interact with messages that may each other at the involve multiple parties message level and multiple sources = concrete message = available message sequence sequences under control of a described from the single party perspectives of all service composition parties (common view) Advanced Software Engineering /Internet Applications service coordination 54/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Business (service) Distribution domain Purchasing Order management Inventory Logical Business processes Process Create, modify, suspend, decomposition/ cancel orders, composition schedule orders, create, modify, delete Business services bulk orders, order progress Infrastructure services Physical Component-based service realizations CRM ERP Packaged Legacy operational systems Databases applications applications Advanced Software Engineering /Internet Applications 55/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Service Composition Elements 1) Composition Model language for composing services - graphical: BPMN - textual: BPEL lets the BP modeler define - a control flow: when to invoke which services - a data flow: with which parameters 2) Development Environment (Design Time) for developing composition models often a graphical editor - e.g. SAP NetWeaver BPM with Eclipse-based Editor for BPMN - activiti.org used by UniFr Solution Engineering 3) Execution Environment (Run Time) composition engine for executing composition models - e.g. SAP NetWeaver BPM with BPEL engine Advanced Software Engineering /Internet Applications 56/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel BPMN article received Business Process Model and Notation Order from < = 2 days supplier Article (BPMN) procured Deliverable? OMG standard (http://www.bpmn.org/) Check availability with > 2 days supplier Late delivery - current version 2.0 graphical process flow model including no undeliverable - activities ( ≈ services) - events that trigger services ( ≈ service calls) - start and end process - send and receive message - control flow and decision points ("gateways") - data flow full notation: http://bpmb.de/poster Advanced Software Engineering /Internet Applications 57/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel BPMN Example: Ordering Goods (SCM) with Swimlanes Advanced Software Engineering /Internet Applications 58/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel BPMN Example: Ordering Goods (SCM) Advanced Software Engineering /Internet Applications 59/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel Business Process Execution Language (BPEL) BPEL as a service composition (orchestration) language facilitates the modeling and execution of business processes based on Web services. is an OASIS standard - see http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html for definition and examples - based on WSDL(1.1!), XPath, XML Schema, and XML models business process collaboration (s) - separates abstract service definition (portType) from concrete binding (operation) - supports dynamic WS binding by reference - synchronous and asynchronous calls models data and control flow of business processes - spawns off & synchronizes processes ( & activities) - event-handling - fault handling & compensation executed in dedicated engines (runtime) - e.g. Apache ODE Advanced Software Engineering /Internet Applications 60/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel BPEL Execution with WSDL Services Advanced Software Engineering /Internet Applications 61/96 AS 2024 – Prof. Jacques Pasquier / Dr. Mourad Kayati / Quentin Nater Inspired from © Prof. Dr. Jürgen Vogel BPEL Example Client print “ Hello World” PrintService