Presentation is loading. Please wait.

Presentation is loading. Please wait.

James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.

Similar presentations


Presentation on theme: "James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario."— Presentation transcript:

1 James Holladay, Mario Sweeney, Vu Tran

2 Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario Sweeney

3 What are Web Services (WS)? Web Services are usually APIs Accessed over a network (local or internet) Service executes on a remote host W3C Definition – A software system that: Allows interaction over a network Interface is described in WSDL Communication via SOAP messages, usually over HTTP

4 Why Web Services? Communication formats are based on XML Not OS – Specific Not Platform - Specific No need to rewrite existing components (expensive!), just write the connecting code

5 Overview of Web Services

6 Requestor and Provider Entities Requestor entity consumes a service Provider entity provides the service Both provide agents that can communicate to implement a particular service

7 Requestor and Provider Agents HW / SW that send and receive messages Requestor Agent and Provider Agent pass SOAP messages, on behalf of the Requestor Entity and Provider Entity

8 Web Services vs. Web Applications Web Services help turn traditional applications into web applications XML allows messages to be sent across applications

9 Using a Web Service Requester (R) and provider (P) become known to each other (UDDI or other directory) They agree on a service description and semantics WSDL R, P use the service description and semantics R, P agents exchange messages to perform a function for the R, P entities SOAP is a protocol for accessing a Web Service (via message-passing)

10 WSDL (WS Description Language) WSDL is an XML-based language W3C standard Used to describe a Web Service Message formats Data types Transport Protocols Used to locate a Web Service May specify 1 or more network locations for invocation

11 WSDL Structure - Data types used by a web service For maximum portability, XML Schema syntax is used - Messages used by a web service Message parts are comparable to function parameters

12 WSDL Structure (continued) - Operations performed by a web service Comparable to a function library, module, or class - Communication protocols used by a web service Defines the message format and protocol details for each port

13 WSDL Code Snippet (w3schools.com) Like F() Like Input Like Output

14 WSDL Ports – Operation Types One-Way Receives a message; will not respond Request-Response (most common) Receives a request; returns a response Solicit-Response Sends a request; waits for a response Notification Sends a message, will not wait for a response

15 SOAP (Simple Object Access Protocol) Communications protocol Format for sending messages Transport over internet application layer (HTTP, SMTP) Platform and language independent Based on XML A W3C standard

16 Some SOAP Syntax Rules A SOAP message: Must be encoded using XML Must use the SOAP Envelope namespace Must use the SOAP Encoding namespace Cannot contain a DTD reference Cannot contain XML Processing Instructions Must have an Envelope root element and a Body element Header is optional, but must be the first child

17 SOAP Structure A SOAP message is an XML document with the following structure: An Envelope element that identifies the XML document as a SOAP message A Header element (optional) defines how a recipient should process it A Body element that contains call and response information A Fault element containing errors and status information SOAP-ENV: Fault

18 SOAP - Namespace The xmlns:soap namespace is “http://www.w3.org/2001/12/soap-envelope” This defines the Envelope element as a SOAP element. If a different namespace is used, the application: Generates an error Discards the message

19 SOAP Message Example (w3schools.com)... Message information goes here...

20 SOAP Header mustUnderstand Attribute (0|1) Whether a header entry is mandatory or optional for a recipient to process If a required entry cannot be processed by a recipient, header processing fails, and the service cannot be used encodingStyle Attribute Defines data types used for the given element, its children No default encoding (SOAP message body contains the actual message)

21 SOAP Body (Request SOAP Message) Gas (Response SOAP Message) 3.21

22 SOAP Fault Element (optional) Used for error messages Can only appear once; Child of the BODY element Sub-elements: Code Readable explanation Who? Fault code examples Client, Server, mustUnderstand, versionMismatch

23 HTTP TCP/IP Example request: POST /item HTTP/1.1 Host: 189.123.345.239 Content-Type: text/plain Content-Length: 200 Example response: 200 OK Content-Type: text/plain Content-Length: 200

24 SOAP HTTP Binding SOAP: HTTP request/response with proper SOAP encoding HTTP + XML = SOAP Request can be POST or GET Content-type is required Syntax: Content-Type: MIMEType; charset=character- encoding Content-length is required Syntax: Content-Length: bytes

25 SOAP Example (Request) POST /InStock HTTP/1.1 Host: www.mySite.com Content-Type: application/soap+xml; charset=utf-8Required Content-Length: nnnRequired NS Defined Chevron Parameter

26 SOAP Example (Response) HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn 3.21 Parameter

27 UDDI (Universal Description, Discovery and Integration) A directory of web service WSDL interfaces Offers information about WS UDDI communicates via SOAP UDDI is built into the Microsoft.NET platform Marketing – product awareness

28 Information / Image Sources W3 (http://www.w3.org/) W3 Schools (http://w3schools.com/) http://soapuser.com/ http://searchsoa.techtarget.com/tip/Demystifying- Web-services-How-they-really-work Wikipedia Other tutorial sites with small snippets of information

29 Now… Tools! Visual Studio (Vu) Net Beans (Mario)

30 Quick Review

31 Credit Card Validation Consumer (Client) Provider (Server) Provider (Server) Provider (Server)

32 Calculator Provider (Server) Java Application Consumer (Client) JSP Consumer (Client) Servlet Application Consumer (Client)

33


Download ppt "James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario."

Similar presentations


Ads by Google