C # Call WebService instances and development

Source: Internet
Author: User
Tags soap client stock prices

C # Call WebService instances and development
1. Basic Concept Web Service is also called XML Web Service WebService. It is a lightweight and independent communication technology that can receive requests from other systems on the Internet or Intranet. Yes: The software services provided on the Web through SOAP are described using the WSDL file and registered through UDDI. A simple understanding is: webservice is a function placed on the server, which can be called by everyone and then return information. For example, google has a web service, and you can easily make a search website by calling it. Just like calling a function, input several parameters (such as keywords and character encoding), and then return the content retrieved by google (return a string ). Among them, Soap :( Simple Object Access Protocol) Simple Object Access Protocol. Is the communication protocol of XML Web Service. After you find your WSDL Description document through UDDI, you can use SOAP to call one or more operations in your Web service. SOAP is a standard for calling methods in XML format. It supports different underlying interfaces, such as HTTP (S) or SMTP. WSDL :( Web Services Description Language) the WSDL file is an XML document that describes a group of SOAP messages and how to exchange them. In most cases, it is automatically generated and used by the software. UDDI (Universal Description, Discovery, and Integration) is a new project mainly for Web service providers and users. Before you can call a Web service, you must determine the business methods contained in the service, find the called interface definition, and compile software on the server, UDDI is a mechanism that guides the system to find the corresponding service based on the description document. UDDI uses the SOAP message mechanism (standard XML/HTTP) to publish, edit, browse, and find registration information. It uses XML format to encapsulate different types of data and sends the data to the Registration Center or the Registration Center to return the required data. Ii. Advantages and disadvantages the main goal of Web Service is cross-platform interoperability. To achieve this goal, Web services are fully based on standards independent of the platform and software vendors, such as XML (Extensible Markup Language) and XSD (XML Schema, is a new platform for creating interoperable and distributed applications. Therefore, the use of Web services has many advantages: 1. Cross-firewall communication if applications have thousands of users and are distributed across the world, therefore, communication between the client and the server is a tricky problem. Because there is usually a firewall or proxy server between the client and the server. The traditional approach is to use a browser as the client, write a lot of ASP pages, and expose the middle layer of the application to the end user. The result is that development is difficult and programs are difficult to maintain. If the client code is no longer so dependent on HTML forms, the client programming will be much simpler. If the intermediate layer component is changed to Web Service, you can directly call the intermediate layer component from the user interface, thus saving the step for creating an ASP page. To call a Web Service, you can directly use a SOAP client such as Microsoft SOAP Toolkit or. net, or use a self-developed SOAP client to connect it to the application. This not only shortens the development cycle, but also reduces Code complexity and enhances the maintainability of applications. At the same time, the application does not need to jump to the corresponding "result page" every time it calls the middle layer components ". 2. Application Integration enterprise-level application developers know that enterprises often need to integrate various programs written in different languages and run on different platforms, this integration will take a lot of development effort. Applications often need to obtain data from programs on a running host, or send data to the host or other platform applications. Even on the same platform, various software products produced by different software vendors often need to be integrated. Through Web Service, applications can use standard methods to "expose" functions and data for other applications. XML Web services provides the ability to exchange messages using standard protocols (HTTP, XML, SOAP, and WSDL) in a loosely coupled environment. Messages can be structured, typed, or loosely defined. 3. B2B integration refers to Business, as in businesses doing business with other businesses, and e-commerce of merchants (generally referred to as enterprises, that is, products, services, and information exchange between enterprises over the Internet. The popular saying means that both the supply and demand sides of e-commerce transactions are merchants (or enterprises or companies). They use Internet technology or various business network platforms to complete the business transaction process. Web Service is the key to successful B2B integration. With Web Service, the company only needs to expose key business applications to specified suppliers and customers, and the Web Service runs on the Internet, it can be easily implemented anywhere in the world, and its operation cost is relatively low. Web Service is only a key part of B2B integration, and many other parts are required for integration. The biggest benefit of implementing B2B integration with Web services is that it can easily implement interoperability. As long as the business logic is exposed and becomes a Web Service, any designated partner can call these business logic, regardless of the platform on which their system runs, the development language used. This greatly reduces the time and cost spent on B2B integration. 4. software and data reuse Web Service allows code reuse while reusing the data behind the code. When using Web Services, you no longer have to purchase and install software components from a third party, as before, and then call these components from the application; you only need to directly call the remote Web Service. Another case of software reuse is to integrate the functions of several applications and expose them through Web Services, you can easily integrate all these functions into your portal to provide users with a unified and friendly interface. You can use the functions provided by third-party Web services in applications, or provide your own application functions to others through Web Services. In both cases, you can reuse the data behind the code and code. From the above discussion, we can see that Web services are most useful when performing interoperability or remote calls through the Web. However, there are also some situations where Web Services cannot bring any benefits at all. Web services have some disadvantages: 1. Currently, many desktop applications are used by enterprises and individuals for standalone applications. Some of them only need to communicate with other programs on the local machine. In this case, it is best not to use Web services, as long as you use local APIs. COM is very suitable for working in this case because it is small and fast. The same is true for the software running on the same server. Of course, Web services can also be used in these scenarios, but that will not only consume too much, but will not bring any benefits. 2. Some LAN applications in many applications, all of which use COM on the Windows platform and run on the same LAN. In these programs, using DCOM is much more effective than SOAP/HTTP. Similarly, if A. net Program is to connect to another. net program on the LAN, it should use. net Remoting. In fact, in. net Remoting, you can also specify the use of SOAP/HTTP for Web Service calls. However, it is better to call RPC directly through TCP, which will be much more effective. 3. Main Applications 1. The initial XML Web Service can be easily incorporated into the application's information sources, such as stock prices, weather forecasts, and sports scores. 2. Provide existing applications in XML Web Service Mode, build new and more powerful applications, and use XML Web Service as the construction block. For example, a user can develop a purchase application to automatically obtain price information from different suppliers, so that the user can select a supplier, submit an order, and then track the transportation of the goods until the goods are received. In addition to providing services on the Web, supplier applications can also use XML Web Service to check the customer's credit, collect the payment, and handle the freight formalities with the freight company. Most of the above content is for reference. The following instance development is implemented by yourself through understanding.

Related Article

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.