1 / 35

Web Services

Web Services. Kanda Runapongsa ( krunapon@kku.ac.th ) Dept. of Computer Engineering Khon Kaen University. Overview. Introduction to Web Services Web Services Standards Java Support for Web Services Apache Axis Installing Apache Axis Invoking a service Deploying a service.

Download Presentation

Web Services

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Services Kanda Runapongsa (krunapon@kku.ac.th) Dept. of Computer Engineering Khon Kaen University

  2. 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. 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 168493: XML and Web Services (II/2546)

  4. 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 168493: XML and Web Services (II/2546)

  5. 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 • 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 168493: XML and Web Services (II/2546)

  7. 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 168493: XML and Web Services (II/2546)

  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 Email • 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 • Distributed object model • Components: packaging and interoperability • Remoting: remote method invocation • COM/DCOM from Microsoft, CORBA, • Java RMI and EJBs 168493: XML and Web Services (II/2546)

  14. 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 168493: XML and Web Services (II/2546)

  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. 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. 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. 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 Message Structure SOAP Envelope: Top-level wrapper SOAP Header (Optional): Extension information SOAP Body: Application data 168493: XML and Web Services (II/2546)

  20. A SOAP Message Example <?xml version=“1.0” encoding=“UTF-8”?> <soap:Envelope xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”> xmlns:addr=“http://www.abc.com/jwsbook/bookQuote”> 168493: XML and Web Services (II/2546)

  21. 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. 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. 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 WSDL 1.1 Document Structure Types Messages Port Types Bindings Services 168493: XML and Web Services (II/2546)

  24. 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. 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. 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. Apache Axis • Apache Axis is a toolkit to create and consume Web Services for the Java platform which can be downloaded from http://ws.apache.org/axis/index.html • 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. 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. 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. 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. 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. 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. 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. References • Web Services with JAX-RPC and Axis http://pankaj-k.net/axis4tag/ 168493: XML and Web Services (II/2546)

More Related