Danh mục

Practical Database Programming With Visual C#.NET- P15

Số trang: 50      Loại file: pdf      Dung lượng: 1.23 MB      Lượt xem: 12      Lượt tải: 0    
Jamona

Phí tải xuống: 14,000 VND Tải xuống file đầy đủ (50 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu practical database programming with visual c#.net- p15, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Practical Database Programming With Visual C#.NET- P15 9.2 Procedures to Build a Web Service 723 WSDL & Message in UDDI Clients SOAP Format Web Server Web Services Request in Prepare XML tags Information Database ASP.NETWeb Services Database ServerFigure 9.1 Typical process of a Web Service.messages containing either document-oriented or procedure-oriented information. Theoperations and messages are described abstractly and then bound to a concrete networkprotocol and message format to define an endpoint. UDDI is an XML-based directory for businesses that list themselves on the Internet.The goal of this directory is to enable companies to find one another on the Web andmake their systems interoperable for e-commerce. UDDI is often considered like a tele-phone book’s yellow and white pages. By using those pages, it allows businesses to listthemselves by name, products, locations, or the Web services they offer. Thus, based on these components and their roles, we can conclude: • XML is used to tag data to be transferred between applications. • SOAP is used to wrap and pack the data tagged in the XML format into the messages represented in the SOAP protocol. • WSDL is used to map a concrete network protocol and message format to an abstract end- point, and describe the Web Services available in an WSDL document format. • UDDI is used to list all Web Services that are available to users and businesses. Figure 9.1 shows a diagram to illustrate these components and their roles in an ASP.NET Web Service process. By now we have obtained the fundamental knowledge about the ASP.NET WebServices and their components. Next let’s see how to build a Web Service project.9.2 PROCEDURES TO BUILD A WEB SERVICEDifferent methods and languages can be used to develop different Web Services such asthe C# Web Services, Java Web Services, and Perl Web Services. In this section we onlyconcentrate on developing the ASP.NET Web Services using the Visual C#.NET 2008.Before we can start to build a real Web Service project, let’s first take a closer look atthe structure of a Web Service project.724 Chapter 9 ASP.NET Web Services9.2.1 Structure of a Typical Web Service ProjectA typical Web Service project contains the following components: 1. As a new Web Service project is created, two page files and two folders are created under this new project. The folder App_Code contains the code-behind page that has all real codes for a simple default Web Service and the Web Service to be created. The folder App_Data is used to store all project data. 2. The code-behind page Service.cs contains the real Visual C#.NET codes for a simple Web Service. Visual Web Developer includes three default namespace declarations to help users to develop Web Services on the top of this page, which are: using System.Web; using System.Web.Services; using System.Web.Services.Protocols; By default, a new code-behind file contains a class named Service that is defined with the WebService and WebServiceBinding attributes. The class defined a default Web method named HelloWorld that is a placeholder, and you can replace it with your own method or methods later when you develop your own Web Service project. 3. The main Web Service page file Service.asmx is used to display information about the Web Service’s methods and provide access to the Web Service’s WSDL information. The exten- sion .asmx means that this is an Active Service Method file, and the letter x is just a rotation of the attached symbol + after the keyword ASP since the ASP.NET was called ASP+ in the early days. If you open the ASMX file on a disk, you will see that it actually contains only one command line: It indicates the programming language in which the Web Service’s code-behind file is written, the code-behind file’s location, and the class that defines the Web Service. When you request the Active Server Method File (ASMX) page through the Internet Information Services (IIS), ASP.NET uses this information to generate the content displayed in the Web browser. 4. The configuration file web.config, which is an XML-based file, is used to set up a configura- tion for the new created Web Service project, such as the namespaces for all kinds of Web components, Connection string, and default authentication mode. Each Web Service project has its own configuration file. Of all the files and folders discussed above, the code-behind page is the most impor-tant file since all Visual C#.NET codes related to building a Web Service are located inthis page, and our major coding development will be concentrated on this page, too.9.2.2 Real Considerations When Building a Web Service ProjectBased on the structure of a typical Web Service project, some issues related to buildingan actual Web Service project are emphasized here, and these issues are very importantand should be followed carefully to successfully create a Web Service project in the VisualStudio.NET environment. As a request is made and sent from a Windows or Web form client over the Internetto the ...

Tài liệu được xem nhiều: