Presentation is loading. Please wait.

Presentation is loading. Please wait.

Faculty of Information Technology 31242/32549 Advanced Internet Programming Advanced Java Programming Web services Intro.

Similar presentations


Presentation on theme: "Faculty of Information Technology 31242/32549 Advanced Internet Programming Advanced Java Programming Web services Intro."— Presentation transcript:

1 Faculty of Information Technology 31242/32549 Advanced Internet Programming Advanced Java Programming Web services Intro

2 Faculty of Information Technology 2 Web Applications Presentation-oriented: –PAGE based –App generates Markup pages (HTML, XHTML etc) –“Human oriented”: user interacts with page: Request/Response –B2C & B2C Service-oriented: “web services” –Service based –Application provides “Remote Procedure Calls/Remote Methods” –“Machine oriented”: –Application interacts with Application: Request/Response (RPC) Message oriented

3 Faculty of Information Technology 3 Web Services – problems solved Before Web: –Traditional approach: “Remote Procedure Calls” or “Remote Method Invocation” –Tied to the underlying architecture –Binary message formats –Compatibility issues –Proprietary technologies and implementations –Expensive, Inflexible, Complex –Not firewall friendly

4 Faculty of Information Technology 4 Web services – problems solved After Web: –Different vendors attempted HTTP based solutions –Web based RPC: Just send and receive plain text via a URL –XML based RPC: Send/receive requests as XML –  XML-RPC “standard” ( ) –Language & technology neutral, but not a standard –  Influenced standards  formalised as SOAP.

5 Faculty of Information Technology 5 Web services - definition “Web services are self-contained, self-describing, modular applications that can be published, located, and invoked across the web.” “Web service applications are encapsulated, loosely coupled web ‘components’ that can bind dynamically to each other.” Web Services  a distributed computing platform

6 Faculty of Information Technology 6 W3C web services standard W3C standard for web services: An application (Consumer) connects to another application (Provider) via SOAP The Consumer knows how to connect to the Provider because the interface is described with WSDL. The Consumer can find the Provider because the provider’s details are published in a UDDI registry. Both communicate using the web protocol, HTTP. The data exchange is via XML and XML Schema

7 Faculty of Information Technology 7 Web Services Introduction

8 Faculty of Information Technology 8 SOAP “Simple Object Access Protocol” SOAP message contains: –Envelope: describes the message and how to process it –Header: contains the features of the SOAP message –Body: contains the primary information for the message receiver

9 Faculty of Information Technology 9 SOAP SOAP works by transmitting XML between the Consumer and Provider. Akin to “Snail Mail” – Envelope is like the mail address, Body is like the content of the letter

10 Faculty of Information Technology 10 SOAP SOAP is a XML Message format Calls and responses are sent as SOAP Envelopes. The message in a SOAP Envelope has a header (optional) and a body. The Body is for application level data. Parameters, method calls etc. The Header is for infrastructure level data. Authentication, coordination etc. Header attributes: actor (none, next, ultimateReceiver) mustUnderstand (1 or 0)

11 Faculty of Information Technology 11 SOAP Request Example IBM getStockPrice(“IBM”)

12 Faculty of Information Technology 12 SOAP Request Example 34.5 getStockPrice(“IBM”)  34.5

13 Faculty of Information Technology 13 SOAP Summary SOAP is a simple protocol intended for transferring data from one application to another. SOAP provides a mechanism for encapsulating RPC calls into SOAP messages (in envelopes). SOAP uses existing, recognised standards to solve problems of data representation and transport. Some SOAP downfalls: No mechanisms for reliability, transactions, security… SOAP is, in itself, not adequate for all needs in industrial applications Extra standards to add missing functionality include –WS-reliable messaging, –WS-Security –WS-Coordination, WS-Transactions

14 Faculty of Information Technology 14 WSDL How do you know how to invoke a web service? –SOAP only specifies the format for message exchange, it doesn’t say what the message itself should contain! –What is the address of the web service? –What are the required parameters? –What protocols are used? Web Services Description Language (WSDL) specifies the answers to these questions

15 Faculty of Information Technology 15 WSDL Structure Service: –collection of endpoints –endpoint = port + binding Binding: –maps operations to protocols (e.g. SOAP via HTTP) Port type: –a set of operations supported by endpoints (like a function library) Operation: –abstract description of an action supported by a service Message: –typed definition of data communication (input and output)

16 Faculty of Information Technology 16 WSDL Elements –Groups related ports together –eg. If a portType is bound to two protocols, they are grouped together –Specifies the location of the web service

17 Faculty of Information Technology 17 WSDL Elements

18 Faculty of Information Technology 18 WSDL Elements –Specifies protocols used to invoke web service Eg. Is this a SOAP web service? Over HTTP? –The abstract interface defined in can be bound to different messaging and transport protocols Eg. SOAP over HTTP, SOAP over SMTP, …

19 Faculty of Information Technology 19 WSDL Elements

20 Faculty of Information Technology 20 WSDL –Defines the interface (similar to Java interface definition) –Defines the actions (similar to Java methods)

21 Faculty of Information Technology 21 WSDL Elements –Defines a set of parameters –Defined messages are referred to in the element

22 Faculty of Information Technology 22 WSDL Elements –Defines the data types used –Referred to by elements –Usually uses XML schema to define types

23 Faculty of Information Technology 23 WSDL Elements …. & so on….

24 Faculty of Information Technology 24 Agenda Introduction to Web Services Enabling technologies: SOAP and WSDL, UDDI JAX-WS

25 Faculty of Information Technology 25 JAX-RPC JAX-RPC was the older standard for interfacing web services with Java This had several flaws – not so easy to use, mainly dealt with RPC style transactions, not built into Java JAX-RPC 2.0 was a refresh & got renamed to JAX- WS

26 Faculty of Information Technology 26 JAX-WS Now built into Java 6 Concept: you write POJO (Plain Old Java Objects) and annotate your code (next slides are from Sun Java user group, tech days 2008 (Carol McDonald))

27 Faculty of Information Technology 27 Developing with JAX-WS

28 Faculty of Information Technology 28 Writing service

29 Faculty of Information Technology 29 JAX-WS mapping

30 Faculty of Information Technology 30 Customising

31 Faculty of Information Technology 31 Client side

32 Faculty of Information Technology 32 Client

33 Faculty of Information Technology 33

34 Faculty of Information Technology 34 Labs We will develop both a server and client using JAX- WS in the labs

35 Faculty of Information Technology 35 Questions?


Download ppt "Faculty of Information Technology 31242/32549 Advanced Internet Programming Advanced Java Programming Web services Intro."

Similar presentations


Ads by Google