(GO) 2.4.1 Basics-the difference between adding a service reference and a Web reference

Source: Internet
Author: User
Tags soap visual studio 2010 wsdl

The 2nd chapter of Web Services Development Learning builds ASP. This chapter will learn about the various ways to create Web services, and focus on creating ASP. NET Web services and modifying properties of Web Services using Visual Studio. This section introduces you to the basics-the difference between adding a service reference and a Web reference.

AD:

2.4.1 Basics-the difference between adding a service reference and a Web reference

Because the. NET Framework 4 does not recommend Web services by default, it implements the functionality of the Web service through WCF. While the. NET Framework 3.5 supports both, there are some differences when adding.

When you create a project or Web site that is based on the. NET Framework 4, right-click the project or site name, and the Add Service Reference command appears only in the popup shortcut menu, as shown in 2-20.

Select to open the Add Service Reference dialog box, where you can enter the address of WCF in the Address drop-down list box, and then click the Go button. 2-21 shows the dialog box effect when adding a WCF service reference.

Figure 2-20 shortcut menu
Figure 2-21 The Add Service Reference dialog box

However, you can also add a service reference through the URL of the Web service. Note, however, that this method does not guarantee the normal use of Web services and is therefore not recommended.

However, it is not complicated to open the Add Web Reference dialog box. Click the Advanced button in the dialog shown in Figure 2-21, and then click the Add Web Reference button from the Service Reference Settings dialog box that pops up, as shown in 2-22.

Figure 2-22 "Service Reference Settings" dialog box

Let's look at the difference between adding a service reference and adding a Web reference.

(1) Adding a service reference is using a WCF service, and adding a Web reference uses a Web service.

(2) Visual Studio 2010 Added the Add Service Reference feature after the upgrade to support the WCF service Library on the. NET Framework 3.0 or 3.5 version. For Web services, it is supported starting with the. NET Framework 1.0.

(3) A project type that has both the Add Service reference and the Add Web reference is a Web service program, including a Web services project. The normal console and form types are not added to the Web reference.

(4) The client agent will be generated by Wsdl.exe after using the Add Web Reference. The command to generate the client agent after using the Add Service reference is svcutil.exe.

(5) The agent generated by the Add Web reference can be called by the. NET Framework 1.0 or the. NET Framework 2.0 client. The proxy generated by the Add Service reference can only be called by clients above the. NET Framework 3.0, and the proxy class is generated after the service reference is added, and the corresponding token is generated in Web. config.

(6) Add a Web reference the generated Reference.cs file contains a service proxy class that is responsible for communicating with the Web service. It inherits a SOAP class, using the SOAP protocol, based on the XML language. It also contains the methods defined in the Web service classes, and the associated asynchronous invocation methods and events. Adhere to the primary rules for. NET Web Service.

(7) Adding a service reference the generated client file Reference.cs also deserializes a local proxy class, which is similar to the former. However, in addition to the service class and some other classes and contractual interfaces related to it, there are service requests and corresponding information. Follow the rules for the WCF Service framework.

Technical documentation The relationship between WCF and Web services

Strictly speaking, the Web service is the industry standard, it has a set of standard system standards, and in the continuous update perfect, that is, the Web service specification, also known as the WS-* specification, is neither a framework nor a technology.

Microsoft's Web service implementation, called ASP, uses soap to implement data interactions between applications in a distributed environment, using WSDL to implement a description of the service interface.

WCF (Windows communication Foundation) is a development framework for a distributed application that belongs to a specific technology, or platform. is neither a standard nor a norm. WCF is, to some extent, an ASP. NET Web service because it supports industry standards and core protocols for Web service. So what ASP. NET Web service can do, WCF is almost capable of, cross-platform and language is not a problem.

But WCF, as a communications platform for Microsoft's main push, aims not only to support and integrate Web Service, because it is also compatible and has the features of many of Microsoft's earlier distributed technologies. WCF will be discussed in detail in the 13th chapter of this book.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.