Tài liệu Module 3: The Underlying Technologies of Web Service pptx

50 509 0
Tài liệu Module 3: The Underlying Technologies of Web Service pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Contents Overview 1 HTTP Fundamentals 2 XML Essentials 14 SOAP Fundamentals 26 Lab 3: Issuing HTTP and SOAP Requests Using the .NET Framework 39 Review 45 Module 3: The Underlying Technologies of Web Services Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, places or events is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.  2001 Microsoft Corporation. All rights reserved. Microsoft, MS-DOS, Windows, Windows NT, Active Directory, Authenticode, Biztalk, Intellisense, Jscript, MSDN, PowerPoint, Visual Basic, Visual C++, Visual C#, Visual Studio, Win32, and Windows Media are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Module 3: The Underlying Technologies of Web Services iii Instructor Notes This module provides students with an overview of the technologies that form the foundation of Extensible Markup Language (XML)-based Web Services. After completing this module, students will be able to: ! Describe the structures of a Hypertext Transfer Protocol (HTTP) request and response. ! Issue HTTP POST and GET requests and process the responses by using the Microsoft ® .NET Framework. ! Describe data types by using the XML Schema Definition language (XSD). ! Explain how to control the way a .NET Framework object is serialized to XML. ! Describe the structures of a Simple Object Access Protocol (SOAP) request and response. ! Issue a SOAP request and process the response by using the .NET Framework. Materials and Preparation This section provides the materials and preparation tasks that you need to teach this module. Required Materials To teach this module, you need the Microsoft PowerPoint ® file 2524A_03.ppt. Preparation Tasks To prepare for this module: ! Read all of the materials for this module. ! Try the walkthroughs and demonstrations in this module. ! Complete the lab. Presentation: 120 Minutes Lab: 45 Minutes iv Module 3: The Underlying Technologies of Web Services Module Strategy This module is intended to demystify the technologies underlying Web Services. Throughout this module, you should emphasize the simplicity of the technologies covered to the students. Use the following strategy to present this module: ! HTTP Fundamentals This section is intended to provide students with a basic understanding of the HTTP protocol and explain how to issue HTTP requests using the .NET Framework. Explain that HTTP is a simple protocol designed for interoperability and not performance. Emphasize how simple HTTP is to understand. ! XML Essentials Explain that XML is fundamental to Web Services. Do not spend much time on the basics of XML. Briefly review the important XML concepts. Cover the topics on XSD as a progressive tutorial, rather than a list of concepts. Explain how the default serialization behavior for .NET Framework data types can be modified. Explain the importance of the ability to modify default serialization behavior of data types. ! SOAP Fundamentals This topic is intended to provide students with a basic understanding of the SOAP protocol and explain how to issue SOAP requests using the .NET Framework. Emphasize that SOAP is the preferred wire format for Web Services. Explain to the students that the .NET Framework handles most of the details of communication using SOAP in Web Services implemented using the .NET Framework. Module 3: The Underlying Technologies of Web Services 1 Overview ! HTTP Fundamentals ! XML Essentials ! SOAP Fundamentals ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** Web Services are built on Web technologies. The three core technologies that form the foundation for Web Services are the Hypertext Transfer Protocol (HTTP), the Extensible Markup Language (XML), and the Simple Object Access Protocol (SOAP). It is important to understand the workings of the three technologies and how the Microsoft ® .NET Framework provides support for these three technologies to be able to use them in Web Services. Because you must be already familiar with the basics of XML, this module provides a refresher of only the XML concepts that are necessary for implementing and using Web Services. After completing this module, you will be able to: ! Describe the structures of an HTTP request and response. ! Issue HTTP POST and GET requests and process the responses by using the Microsoft .NET Framework. ! Describe data types by using the XML Schema Definition language (XSD). ! Explain how to control the way a .NET Framework object is serialized to XML. ! Describe the structures of a SOAP request and response. ! Issue a SOAP request and process the response by using the .NET Framework. Topic Objective To provide an overview of the module topics and objectives. Lead-in In this module, you will learn about the some of the technologies underlying Web Services. Note 2 Module 3: The Underlying Technologies of Web Services " "" " HTTP Fundamentals ! Overview of HTTP ! Structures of HTTP Requests and Responses ! The GET and POST Methods ! HTTP Using the .NET Framework ! Code Walkthrough: Issuing a Synchronous HTTP Request ! Code Walkthrough: Issuing an Asynchronous HTTP Request ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** The Hypertext Transfer Protocol (HTTP) is a World Wide Web Consortium (W3C) standard for transferring documents on the Internet. Web Services can use HTTP for communication. In this section, you will learn the fundamentals of HTTP and how to make HTTP requests using the .NET Framework. Topic Objective To introduce the topics in this section. Lead-in In this section, you will learn the fundamentals of HTTP and how to make HTTP requests using the .NET Framework. Module 3: The Underlying Technologies of Web Services 3 Overview of HTTP ! Syntax of a URL ! Example ! Stateless Protocol http://host[:port][path[?querystring]] http://host[:port][path[?querystring]] http://www.woodgrovebank.com/accts.asp?AccNo=23 http://www.woodgrovebank.com/accts.asp?AccNo=23 ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** A resource location is specified in HTTP through a mechanism known as a Uniform Resource Locator (URL). Strictly speaking, the mechanism used in HTTP is a Uniform Resource Identifier (URI), but we can also think of it as a URL. A URI identifies a document, whereas a URL identifies a document and its location. Syntax of a URL The syntax of a URL is as follows: http://host[:port][path[?querystring]] The following is an example of a URL: http://www.woodgrovebank.com/accts.asp?AccNo=23 In the preceding example, www.woodgrovebank.com is the host, accts.asp is the path and AccNo=23 is the query string. If the port number is not specified (as in the preceding example), the default port for HTTP, which is port 80, is used. Stateless Protocol HTTP is a stateless protocol. This means that whenever a request is made by the client, the connection to the server is closed after the response is received from the server. Therefore, if any state must be maintained between the client and the server, the server must pass on state information with the response to the client. This will enable the server to recover this information from the client when it receives the next request. For example, if you implement a Web site that displays user-specific content, you would have to implement a mechanism that retains information about the current user in order to display personalized content. Topic Objective To explain URLs and how HTTP is a stateless protocol. Lead-in Resource locations are specified in HTTP through URLs. Note Example 4 Module 3: The Underlying Technologies of Web Services Structures of HTTP Requests and Responses ! Requests ! Responses POST /TheStockExchange/Trading/GetStockPrice.asp HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: 11 Symbol=MSFT POST /TheStockExchange/Trading/GetStockPrice.asp HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: 11 Symbol=MSFT HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: 75 <?xml version="1.0" encoding="utf-8"?> <stock symbol="MSFT" Price="71.50" /> HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: 75 <?xml version="1.0" encoding="utf-8"?> <stock symbol="MSFT" Price="71.50" /> Note the blank line! ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** HTTP requests and responses have a simple structure. Structure of an HTTP Request An HTTP request has the following format: method URL Version headers a blank line message body An example code of an HTTP request is as follows: POST /TheStockExchange/Trading/GetStockPrice.asp HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: 11 <?xml version="1.0" encoding="utf-8"?> <Symbol=MSFT /> Topic Objective To describe the structures of an HTTP request and response. Lead-in HTTP requests and responses have simple structures. Syntax Example Module 3: The Underlying Technologies of Web Services 5 The first line in an HTTP request is known as the request line, and the methods that are supported by a request are as follows: ! OPTIONS ! GET ! HEAD ! POST ! DELETE ! TRACE ! CONNECT ! extension-method In Course 2524A, Developing XML Web Services Using Microsoft Visual C# .NET Beta 2, you will learn about the GET and POST methods only. Structure of an HTTP Response An HTTP response has the following format: Version Status-Code Description headers a blank line message body Example An example code of an HTTP response is as follows: HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: 75 <?xml version="1.0" encoding="utf-8"?> <stock symbol="MSFT" Price="71.50" /> Note S yntax 6 Module 3: The Underlying Technologies of Web Services The GET and POST Methods ! HTTP-GET ! HTTP-POST GET /Trading/GetStockPrice.asp?Symbol=MSFT HTTP/1.1 Host: localhost GET /Trading/GetStockPrice.asp?Symbol=MSFT HTTP/1.1 Host: localhost POST /Trading/GetStockPrice.asp HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: 11 Symbol=MSFT POST /Trading/GetStockPrice.asp HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: 11 Symbol=MSFT ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** The GET and POST request methods are ideal for communicating with a Web Service. This is because these methods are designed specifically for submitting data to a Web server and retrieving a specified resource from a Web server. This makes it possible to layer a function call model on top of these methods, which is exactly the model required for Web Services. HTTP-GET Request Consider the following HTTP-GET request: GET /Trading/GetStockPrice.asp?Symbol=MSFT HTTP/1.1 Host: localhost The most important feature of the request line is the querystring. The querystring is the portion of the URI that follows the question mark, and consists of a set of URL-encoded name/value pairs. In an HTTP-GET request, there is typically no message body. The response for a GET request is just a standard HTTP response, which is described in the previous topic. Topic Objective To describe GET and POST methods and explain the differences between them. Lead-in The GET and POST request methods are ideal for Web Services communication. Delivery Tip While discussing the details of an HTTP-GET request, point out to the parts of the corresponding URL on the preceding slide, in particular the query string. Emphasize that the body is empty. [...]... USE****************************** In the context of Web Services, XML is used to describe the Web Service interfaces The interface descriptions for a Web Service include definitions of the datatypes for each operation and the format of the messages that are exchanged between a Web Service consumer and a Web Service Module 3: The Underlying Technologies of Web Services 15 Overview of XML Topic Objective To explain the important... less restrictions on the kind of data that is sent to the server In Module 5, “Implementing a Simple Web Service, ” in Course 2524A, Developing XML Web Services Using Microsoft Visual C# NET Beta 2, you will see how the choice of an HTTP request method affects the kinds of interfaces the Web Services can expose 7 8 Module 3: The Underlying Technologies of Web Services HTTP Using the NET Framework Topic... within the SOAP Body element In the context of Web Services, the Body element comprises the data specific to the actual method call, such as the Web Service method name and parameters and/or return values for the method invocation 30 Module 3: The Underlying Technologies of Web Services SOAP Fault The SOAP Fault element is used to transport error or status information or both, within a SOAP message If the. .. Framework handles these details You will briefly examine protocol bindings when you look at the NET Framework support for SOAP later in this module Module 3: The Underlying Technologies of Web Services 29 Structure of SOAP Messages Topic Objective To explain the structure of SOAP messages and how they can be used in Web Services Lead-in A SOAP message consists of the Envelope element at the root, which... document structure You will learn the basics of XSD later in this module For more information about WSDL, see Module 4, “Consuming Web Services,” in Course 2524A, Developing XML Web Services Using Microsoft Visual C# NET Beta 2 Module 3: The Underlying Technologies of Web Services 17 XSD Fundamentals Topic Objective To provide a brief overview of XSD Lead-in One of the most important activities involved... 32 Module 3: The Underlying Technologies of Web Services Delivery Tip To explain the sample code to the students, open the file \Democode\Mod03\ SOAP Response.txt In the preceding code, the endpoint of the GetAccount method is specified in the SOAPAction header, and the method and its parameters are contained in the soap:Body element The response to the preceding method... of the fault It must be present within the SOAP Fault element and must provide information explaining the nature of the fault ! faultactor The purpose of the faultactor element is to provide information about who caused the fault to happen within the message path It indicates the source of the fault The value of the faultactor element is an URI that identifies the source Applications that are not the. . .Module 3: The Underlying Technologies of Web Services Delivery Tip While discussing the details of an HTTP-POST request point out to the parts of the corresponding URL on the preceding slide Emphasize that there is typically no query string Also, point out the blank line between the header and the body HTTP-POST Request Consider the following HTTP-POST request: POST... some of the important concepts of XML, let us look at how XML is used in Web Services Schemas To be able to successfully use a Web Service, you need to know the operations supported by the Web Service and the structure of the documents (or messages) that are consumed and produced by each operation This information is defined in a document, known as a service description, which describes a Web Service The. .. 38, the response content is retrieved exactly in the way it is done in a synchronous operation 14 Module 3: The Underlying Technologies of Web Services " XML Essentials Topic Objective To introduce the topics in this section Lead-in In this section, you will review some of the important concepts of XML that are relevant to Web Services ! Overview of XML ! XSD Fundamentals ! XML Serialization in the . Minutes iv Module 3: The Underlying Technologies of Web Services Module Strategy This module is intended to demystify the technologies underlying Web Services most of the details of communication using SOAP in Web Services implemented using the .NET Framework. Module 3: The Underlying Technologies of Web Services

Ngày đăng: 10/12/2013, 16:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan