WS Unit 1.pdf
Document Details
Uploaded by AffluentReal
Tags
Full Transcript
Web Services Restaurant example USER WEBSERVICE PROVIDER WebService Example Web Service definition A simple definition: “a Web Service is an application component accessible over open protocols”. Web Service definition revisited A more p...
Web Services Restaurant example USER WEBSERVICE PROVIDER WebService Example Web Service definition A simple definition: “a Web Service is an application component accessible over open protocols”. Web Service definition revisited A more precise definition: an application component that: Communicates via open protocols (HTTP, SMTP, etc.) Processes XML messages framed using SOAP Describes its messages using XML Schema Provides an endpoint description using WSDL Can be discovered using UDDI Web Services Its purpose is to complete certain task, solves problems, or conducts transactions on behalf of a user or application. It constitute a distributed computer infrastructure made up of many different interacting application modules communicating over a network (private, public or a single logical system) Web Services Web services perform encapsulated business functions such as: a self-contained business task – a funds withdrawal or funds deposit service; a full-fledged business process – the automated purchasing of office supplies; an application – a life insurance application or demand forecasts and stock replenishment; or a service-enabled resource – access to a particular back-end database containing patient medical records. Web Services Can be mixed and matched to create a complete process: Enable integration with decreased human interaction, e.g., create complete enterprise processes, such as supply chain management, procurement, logistics, etc. Both new and extensions to existing applications Available to a variety of clients (platform independent) Pricing (rating) model determines subscriber rates based on subscription and usage events, e.g., calculate charges for services based on the quality and precision of the service. Billing model: “pay per use”, “lease it”, “pay for it” basis The Web Service Model The Web Services model follows the publish, find, and bind paradigm. Web Service Registry 1. publish 2. find Web Service 3. bind/invoke Web Service Provider Client A purchase order application involving interacting web services Service Oriented Architecture(SOA) What is Service-Oriented Architecture? Service-Oriented Architecture (SOA) is an architectural style. Applications built using an SOA style deliver functionality as services that can be used or reused when building applications or integrating within the enterprise or trading partners. SOA Uses open standards to integrate software assets as services Standardizes interactions of services Services become building blocks that form business flows Services can be reused by other applications What is a Service? A service is a reusable component that can be used as a building block to form larger, more complex business-application functionality. A service may be as simple as “get me some person data,” or as complex as “process a disbursement.” What is a Service? A service provides a discrete business function that operates on data. Its job is to ensure that the business functionality is applied consistently, returns predictable results, and operates within the quality of service required. What is a Service? How the service is implemented, and how a user of the service accesses it, are limited only by the SOA infrastructure choices of the enterprise. From a theory point of view, it really doesn’t matter how a service is implemented. Characteristics of a Service Supports open standards for integration: Although proprietary integration mechanisms may be offered by the SOA infrastructure, SOA’s should be based on open standards. Open standards ensure the broadest integration compatibility opportunities. Characteristics of a Service Loose coupling: The consumer of the service is required to provide only the stated data on the interface definition, and to expect only the specified results on the interface definition. The service is capable of handling all processing (including exception processing). Characteristics of a Service Stateless: The service does not maintain state between invocations. It takes the parameters provided, performs the defined function, and returns the expected result. If a transaction is involved, the transaction is committed and the data is saved to the database. Characteristics of a Service Location agnostic: Users of the service do not need to worry about the implementation details for accessing the service. The SOA infrastructure will provide standardized access mechanisms with service- level agreements. Examples of SOA Frameworks Jini Java based Incorporates discovery, leasing, anonymous routing. Takes advantage of code mobility afforded by Java Web services Open standards based Uses XML as the data description format Usually runs on open transports such as http. Distributed Computing Infrastructure Distributed Computing Distributed computing studies the models, architectures, and algorithms used for building and managing distributed systems. As general definition of the term distributed system, we use the one proposed by Tanenbaum A distributed system is a collection of independent computers that appears to its users as a single coherent system. A distributed system is one in which components located at networked computers communicate and coordinate their action only by passing messages. As specified in this definition, the components of a distributed system communicate with some sort of message passing. This is a term the encompasses several communication models. Maya Nair 7/29/2021 23 Components of distributed System Applications Frameworks for distributed programming Middleware IPC primitives for control and data. Operating System Networking and Parallel Hardware Hardware Maya Nair 7/29/2021 24 Examples of Distributed Systems Banking systems Communication - email Distributed information systems WWW Federated Databases Manufacturing and process control Inventory systems General purpose (university, office automation) Maya Nair 7/29/2021 25 System Architectural Styles System architectural styles cover the physical organization of components and processes over a distributed infrastructure. Two fundamental reference style Client / Server The information and the services of interest can be centralized and accessed through a single access point : the server. Multiple clients are interested in such services and the server must be appropriately designed to efficiently serve requests coming from different clients. Peer- to – Peer Symmetric architectures in which all the components, called peers, play the same role and incorporate both client and server capabilities of the client/server model. More precisely, each peer acts as a server when it processes requests from other peers and as a client when it issues requests to other peers. Maya Nair 7/29/2021 26 Client / Server architectural Styles request Two Tier (Classic Model) client response server Three Tier client Server/client server N Tier server Server/clie Server/clien client Maya Nair nt t server 7/29/2021 27 Peer-to-Peer architectural Style peer peer peer peer peer peer peer Maya Nair 7/29/2021 28 Communication Technologies for Distributed computing Remote Procedure Call (RPC) A remote process hosts a server component, thus allowing client processes to request the invocation of methods, and returns the result of the execution. Distributed Object Frameworks This is an implementation of the RPC model for the object-oriented paradigm and contextualizes this feature for the remote invocation of methods exposed by objects Common Object Request Broker Architecture (CORBA): Distributed Component Object Model (DCOM/COM+) Remote Method Invocation(RMI).NET Remoting Service Oriented Architecture(Webservices) Maya Nair 7/29/2021 29 Remote Procedure Call(RPC) RPC allows extending the concept of a procedure call beyond the boundaries of a process and a single memory address space. The called procedure and calling procedure may be on the same system or they may be on different systems in a network 7/29/2021 30 Maya Nair Distributed object frameworks Distributed object frameworks extend object-oriented programming systems by allowing objects to be distributed across a heterogeneous network and provide facilities so that they can coherently act as though they were in the same address space 1. The server process maintains a registry of active objects that are made available to other processes. According to the specific implementation, active objects can be published using interface definitions or class definitions. 2. The client process, by using a given addressing scheme, obtains a reference to the active remote object. This reference is represented by a pointer to an instance that is of a shared type of interface and class definition. 3. The client process invokes the methods on the active object by calling them through the reference previously obtained. Parameters and return values are marshaled as happens in the case of RPC. Ex: Common Object Request Broker Architecture (CORBA): Distributed Component Object Model (DCOM/COM+) Remote Method Invocation(RMI).NET Remoting Maya Nair 7/29/2021 31 Types of Webservices SOAP Web service- It’s based on SOAP protocol which stands for Simple Object Access protocol. It’s completely XML based protocol which uses SOAP envelope(header and body) to communicate between 2 parties. It provides additional security with its Web Service security. Standardized by W3C (World Wide Web consortium ) Restful web service(Rest stands for Representational state transfer.)- Restful web service are architectural based services unlike SOAP which is protocol based. In Rest architecture, everything is treated as resource and which is identified by unique URI. It can handle any type of data which could be XML, JSON or anything. SOAP Web Services Components XML – eXtensible Markup Language – A uniform data representation and exchange mechanism. SOAP – Simple Object Access Protocol – A standard way for communication.(Service Oriented Architecture Protocol) UDDI – Universal Description, Discovery and Integration specification – A mechanism to register and locate WS based application. WSDL – Web Services Description Language – A standard meta language to described the services offered. Example – A simple SOAP Web Service A buyer (which might be a simple client) is ordering goods from a seller service. The buyer finds the seller service by searching the UDDI directory. The seller service is a Web Service whose interface is defined using Web Services Description Language (WSDL). The buyer is invoking the order method on the seller service using Simple Object Access Protocol (SOAP) and the WSDL definition for the seller service. The buyer knows what to expect in the SOAP reply message because this is defined in the WSDL definition for the seller service. XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe data. XML tags are not predefined. You must define your own tags. The prefect choice for enabling cross-platform data communication in Web Services. SOAP SOAP originally stood for "Simple Object Access Protocol". Web Services expose useful functionality to Web users through a standard Web protocol called SOAP. Soap is an XML vocabulary standard to enable programs on separate computers to interact across any network. SOAP is a simple markup language for describing messages between applications. Soap uses mainly HTTP as a transport protocol. That is, HTTP message contains a SOAP message as its payload section. SOAP Building Blocks A SOAP message is an ordinary XML document containing the following elements: A required Envelope element that identifies the XML document as a SOAP message. An optional Header element that contains header information. A required Body element that contains call and response information. An optional Fault element that provides information about errors that occurred while processing the message. SOAP Message structure Consider an example of a client making the request for price of a stock maintained by the provider using a function GetStockPrice() defined in WSDL. Let the stock name be ‘IBM ‘. From clients end a SOAP request message goes to Provider’s end. Provider executes the function and its result is provided back to the client using a SOAP response message. SOAP Request POST /InStock HTTP/1.1 Host: www.stock.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 150 IBM SOAP Response HTTP/1.1 200 OK Content-Type: application/soap; charset=utf-8 Content-Length: 126 34.5 Soap Structure (contd.) An Envelope element that identifies the XML document as a SOAP message – This is the containing part of the SOAP message and is used to encapsulate all the details in the SOAP message. This is the root element in the SOAP message. A Header element that contains header information – The header element can contain information such as authentication credentials which can be used by the calling application. It can also contain the definition of complex types which could be used in the SOAP message. By default, the SOAP message can contain parameters which could be of simple types such as strings and numbers, but can also be a complex object type. Soap Structure (contd.) Body − Contains the XML data comprising the message being sent. It is a mandatory element. The SOAP body is a mandatory element that contains the application-defined XML data being exchanged in the SOAP message. The body must be contained within the envelope and must follow any headers that might be defined for the message. The body is defined as a child element of the envelope, and the semantics for the body are defined in the associated SOAP schema.The body contains mandatory information intended for the ultimate receiver of the message. Fault − An optional Fault element that provides information about errors that occur while processing the message. If an error occurs during processing, the response to a SOAP message is a SOAP fault element in the body of the message, and the fault is returned to the sender of the SOAP message. The SOAP fault mechanism returns specific information about the error, including a predefined code, a description, and the address of the SOAP processor that generated the fault. For HTTP binding, a successful response is linked to the 200 to 299 range of status codes. SOAP Fault is linked to the 500 to 599 range of status codes. SOAP Communication Model ⚫ The client would format the information regarding the procedure call and any arguments into a SOAP message and sends it to the server as part of an HTTP request. This process of encapsulating the data into a SOAP message was known as Marshalling. ⚫ The server would then unwrap the message sent by the client, see what the client requested for and then send the appropriate response back to the client as a SOAP message. The practice of unwrapping a request sent by the client is known as Demarshalling. WSDL WSDL stands for Web Services Description Language. WSDL is an XML vocabulary for describing Web services. It allows developers to describe Web Services and their capabilities, in a standard manner. WSDL specifies what a request message must contain and what the response message will look like in unambiguous notation. In other words, it is a contract between the XML Web service and the client who wishes to use this service. In addition to describing message contents, WSDL defines where the service is available and what communications protocol is used to talk to the service. The WSDL Document Structure ⚫ Definition ⚫ TargetNamespace ⚫ DataTypes ⚫ Messages ⚫ Porttype ⚫ Bindings ⚫ service The WSDL Document Structure ⚫ ⚫