Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML and Web Services (II/2546)

Similar presentations


Presentation on theme: "XML and Web Services (II/2546)"— Presentation transcript:

1 168493 XML and Web Services (II/2546)
Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University Dept. of Computer Engineering, Khon Kaen U.

2 168493: XML and Web Services (II/2546)
Overview Introduction to Web Services Web Services Standards Java Support for Web Services Apache Axis Installing Apache Axis Invoking a service Deploying a service 168493: XML and Web Services (II/2546)

3 168493 XML and Web Services (II/2546)
Web Services -- Basics Expose services to other processes Internet or intranet Black boxes Component-like, reusable Do not know how the service is implemented Based on open standards HTTP, XML, and SOAP Today there is a strong desire for easy-to-use and easy-to-create Web applications, and those applications are required to be language and platform independent. Web Services expose their functionality via standard Web protocols, like HTTP and XML, and enable you to interconnect Web applications. Broadly speaking, Web Services are URL-addressable resources that return requested information to a client or manipulate the data model behind the Web Service. Black boxes Like components, Web Services are black boxes and can be reused without knowledge about how the service is implemented. Based on open standards Web Services are based on open standards like HTTP, XML, and SOAP. So any application that supports these standards is able to support Web Services. 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

4 168493 XML and Web Services (II/2546)
Web Services -- Basics Interconnect Applications Different clients Many devices Distribution and integration of application logic Web Services are loosely coupled Enable the programmable Web Not just purely interactive Web Interconnect With Web Services, you can easily connect applications – even via the Internet. Different clients can make use of Web Services. For example, a browser can make use of the functionality the service offers. Also Web Services themselves can communicate with each other or just call methods that are provided by other Web Services. And many different devices can consume Web Services. For example, a WAP device such as a mobile phone can invoke a Web Service. Distribution and integration of application logic A significant advantage of Web Services is that developers can program against a Web Service to import its functionality into their own Web Service to import its functionality into their own Web applications. We now have the technology to not only distribute application logic, but also to integrate functionality that is provided by a ‘service’ that resides ‘somewhere out there’ Web Services are loosely coupled Because Web Services are loosely coupled, you can change the implementation of a service without affecting the connected partner. The basic principle to achieve this is a homogeneous infrastructure that meets two requirements: First, we need underlying protocols that are common to all communicating entities. This is covered because Web Services are based on the aforementioned open standards. One important point to stress is that XML plays a major role here. Second, we need to ensure that communication takes place asynchronously through messages. Enable the “programmable Web” Because of these characteristics, Web Services enable the programmable Web. We are no longer restricted to a purely interactive Web. 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

5 168493: XML and Web Services (II/2546)
Web Services -- Basics What is a ‘Web Service’? ‘Web’ accessible Usually implies accessible via HTTP Service architecture Request/response XML data transfer Many serious Web services in use for years Custom XML formats specific for each service 168493: XML and Web Services (II/2546)

6 Web Services -- Examples
XML and Web Services (II/2546) Web Services -- Examples A Stock quote service The request asks for the current price of a specified stock The response gives the stock price A service that maps out an efficient route for the delivery of goods A business sends a request containing the delivery destinations The response returns the most cost-effective delivery route Web services, in the general meaning of the term, are services offered via the Web. In a typical Web services scenario, a business application sends a request to a service at a given URL using the SOAP protocol over HTTP. The service receives the request, process it, and returns a response. An often-cited example of a Web service is that of a stock quote service, in which the request asks for the current price of a specified stock, and the response gives the stock price. This is one of the simplest forms of a Web service in that the request is filled almost immediately, with the request and response being parts of the same method call. Another example could be a service that maps out an efficient route for the delivery of goods. In this case, a business sends a request containing the delivery destinations, which the service processes to determine the most cost-effective delivery route. 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

7 Web Services -- Examples
XML and Web Services (II/2546) Web Services -- Examples Web services and consumers of Web services are typically businesses, making Web services predominantly business-to-business (B2B) transactions An enterprise can be the provider of Web services and also the consumer of other Web services Web services and consumers of Web services are typically businesses, making Web services predominantly business-to-business (B2B) transactions. An enterprise can be the provider of Web services and also the consumer of other Web services. For example, a wholesale distributor of rices could be the consumer role when it uses a Web services to check on the availability of rices and in the provider role when it supplies prospective customers with different vendor’s prices for rices. 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

8 Web Services Interaction Diagram
UDDI Registry 1 Request WSDL location 2 Download WSDL WSDL Send SOAP messages With XML documents Web Services 3 168493: XML and Web Services (II/2546)

9 Web Services Infrastructure
Language and platform independent infrastructure for loosely-coupled, inter-operable App2app communication over the Internet 168493: XML and Web Services (II/2546)

10 Web Services Infrastructure
Language and platform independent Separation of specification and implementation Loosely coupled Message based, synchronous and asynchronous interactions 168493: XML and Web Services (II/2546)

11 Web Services Infrastructure
Over the Internet No centralized control, use of established protocols, security considerations Inter-operable Standards based 168493: XML and Web Services (II/2546)

12 Early (Internet) Technologies
SMTP/MINE: Protocols of FTP, NNTP HTTP/HTTPs, HTML The protocols behind the Internet’s popularity Most of these facilitated application to human interaction over the Internet/intranet 168493: XML and Web Services (II/2546)

13 Early (Intranet) Technologies
XML and Web Services (II/2546) Early (Intranet) Technologies Distributed object model Components: packaging and interoperability Remoting: remote method invocation COM/DCOM from Microsoft, CORBA, Java RMI and EJBs If we are talked about distributed computing, we are talking about the client/server model. Today this term implicitly means three-tier architecture, where we have: First tier: user interface Second tier: business logic Third tier: database Normally each of these tiers resides on a dedicated machine. The first tier is on a client, which could be a browser. The second tier is on a server, in this case the Web server. The last tier could be, for example, a Microsoft SQL Server database. Distributed computing requires distributed object model or remoting architecture. With this you can develop distributed applications as you did with a local programming model, and even call services on remote systems. This is called remoted method invocation. Besides this we need the ability to interchange services – or components. Components are black boxes offering services or functionalities, and they provide for packaging and interoperability. The most import object models today are: COM: Component Object Model CORBA: Common Object Request Broker Architecture Java RMI and EJB: Java Remote Method Invocation and Enterprise JavaBeans. 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

14 168493 XML and Web Services (II/2546)
What’s Wrong with That? Limited COM support on non-Windows platforms COBRA: Server object implementation not portable Most of these facilitated app2app within a trusted intranet and without much consideration to interoperability across different implementations Object models like COM, COBRA, and RMI tightly couple a service and the consumer of this service. This is a reason for the need of a homogeneous infrastructure. But there’s no guarantee that the service and the consumer use the same operating system, programming language, or object model. Another problem arises with versioning: if the implementation changes on one side, the other side will fail. Limited COM support on non-Windows platforms While COM is widely supported on the Windows platform, the support on non-Windows platforms like UNIX is limited. The usage of COM within Java requires the Microsoft Java Virtual Machines. This is really an issue, because Microsoft JVM is not supported on non-Windows platforms. From the beginning COBRA was designed to target the problem of inter-machine communication, providing for cross-language and cross-platform interoperability. However, since COBRA is a specification – not a product – implementation of COBRA are vendor specific. So, if you make use of vendor-specific features or services, your applications may not be portable. With Enterprise JavaBeans, you are tied to one language: Java 168493: XML and Web Services (II/2546) Dept. of Computer Engineering, Khon Kaen U.

15 App2App Interaction – the Web Services Way
Transport protocol HTTP/HTTPS Data encoding SOAP (Simple Object Access Protocol) XML Schema Interface Description WSDL (Web Services Description Language) 168493: XML and Web Services (II/2546)

16 The Web Services Way (Cont)
Service Description and Discovery UDDI (Universal Description, Discovery and Integration) Security WS-Security, XML-Signature, XML-Encryption 168493: XML and Web Services (II/2546)

17 168493: XML and Web Services (II/2546)
What is SOAP? Simple Object Access Protocol It defines a standard packaging format for transmitting XML data between applications on a network Usually request-response structure Transport normally HTTP, but can be anything (SMTP, etc.) 168493: XML and Web Services (II/2546)

18 168493: XML and Web Services (II/2546)
A SOAP Message A SOAP message is just an XML document The message might be sent from one application to another to synchronize contact information on two different systems SOAP takes advantages of XML namespaces and XML schemas 168493: XML and Web Services (II/2546)

19 SOAP Message Structure
Envelope is wrapper for content, but no useful information Optional header can contain control information Body contains actual data in XML encoding Attachments can hold other types of data (binary, etc.) SOAP Envelope: Top-level wrapper SOAP Header (Optional): Extension information SOAP Body: Application data 168493: XML and Web Services (II/2546)

20 168493: XML and Web Services (II/2546)
A SOAP Message Example <?xml version=“1.0” encoding=“UTF-8”?> <soap:Envelope xmlns:soap=“ xmlns:addr=“ 168493: XML and Web Services (II/2546)

21 168493: XML and Web Services (II/2546)
A Soap Message Example <soap:Body> <addr:address> <addr:name>Amazon.com</addr:name> <addr:zip>90952</addr:zip> </addr:address> </soap:Body> </soap:Envelope> 168493: XML and Web Services (II/2546)

22 168493: XML and Web Services (II/2546)
WSDL Web Services Description Language A standard for describing the structure of the XML data exchanged between two systems using SOAP When you create a new Web service, you can also create a WSDL document that describes about the type of data we are exchanging 168493: XML and Web Services (II/2546)

23 WSDL 1.1 Document Structure
A WSDL document describes What the service can do Where it resides How to invoke it WSDL descriptions can be made available from an UDDI registry Types Messages Port Types Bindings Services 168493: XML and Web Services (II/2546)

24 168493: XML and Web Services (II/2546)
Why Do We Need UDDI? Universal Description, Discovery, and Integration We still need a guidance to find the WSDL documents UDDI can help others find our Web services easily and use them to communicate with our Web services 168493: XML and Web Services (II/2546)

25 168493: XML and Web Services (II/2546)
What is UDDI? UDDI defines a standard set of Web service operations that are used to store and look up information about other Web service applications UDDI defines a standard SOAP-based interface for a Web services registry A UDDI is often referred to as a “Yellow Pages” for Web services 168493: XML and Web Services (II/2546)

26 168493: XML and Web Services (II/2546)
Java APIs for XML Java API for XML Processing (JAXP) – Process XML documents using various parsers Java API for XML-based RPC (JAX-RPC) – sends SOAP method calls Java API for XML Registries (JAXR) – provides a standard way to access 168493: XML and Web Services (II/2546)

27 168493: XML and Web Services (II/2546)
Apache Axis Apache Axis is a toolkit to create and consume Web Services for the Java platform which can be downloaded from Axis 1.1 supports numerous Java technologies SAAJ (SOAP with Attachments API for XML) JAX-RPC (Java API for XML based Remote Procedure Call) 168493: XML and Web Services (II/2546)

28 168493: XML and Web Services (II/2546)
Apache Axis A simple stand-alone server A server which plugs into servlet engines such as Tomcat Extensive support for the Web Service Description Language (WSDL) Emitter tooling that generates Java classes from WSDL A tool for monitoring TCP/IP packets 168493: XML and Web Services (II/2546)

29 Apache Axis – Web Service
Create an object that has methods and publish it on the Internet You can access your Web service just like if it was a local object through a protocol called SOAP All the operations of a Web service are expressed through a WSDL The WSDL file is used to access and call operations on Web services 168493: XML and Web Services (II/2546)

30 168493: XML and Web Services (II/2546)
Concepts: SOAP & AXIS Apache Axis is an Open Source SOAP server and client SOAP is a mechanism for inter-application communication between systems written in arbitrary languages, across the Internet 168493: XML and Web Services (II/2546)

31 168493: XML and Web Services (II/2546)
Concepts: SOAP & AXIS SOAP usually exchanges messages over HTTP The client POSTs a SOAP request The client then receives either An HTTP success code and a SOAP response Or an HTTP error code Open Source means that you get the source, but there is no formal support 168493: XML and Web Services (II/2546)

32 168493: XML and Web Services (II/2546)
Concepts: SOAP & AXIS SOAP messages are XML messages These messages exchange structured information between SOAP systems Messages consist of one or more SOAP elements inside an envelope, Headers, and the SOAP Body 168493: XML and Web Services (II/2546)

33 168493: XML and Web Services (II/2546)
Concepts: SOAP & AXIS Axis handles the magic of converting Java objects to SOAP data when it sends it over the wire or receive results SOAP Faults are sent by the server when something goes wrong; Axis converts these to Java exceptions 168493: XML and Web Services (II/2546)

34 168493: XML and Web Services (II/2546)
Concepts: SOAP & AXIS Axis implements the JAX-RPC API, one of the standard ways to program Java services Axis is compiled in the JAR file axis.jar; it implements the JAX-RPC API declared in the JAR files jaxrpc.jar and saaj.jar 168493: XML and Web Services (II/2546)

35 168493: XML and Web Services (II/2546)
References Web Services with JAX-RPC and Axis 168493: XML and Web Services (II/2546)


Download ppt "XML and Web Services (II/2546)"

Similar presentations


Ads by Google