Traditional Culture Encyclopedia - Weather inquiry - How to add a reference to webservice and publish it to the server?

How to add a reference to webservice and publish it to the server?

Add a reference to the webservice and publish it to the server:

1. Select file->; New-> Project.

2. Select the console application in the project and rename the project as WebServiceTest.

3. Right-click the item and select Add-> Service reference.

4. Enter the WebServie link address in the address bar and press Enter, then rename the service name to ServiceGetWeather, and click OK to view the service application added in the code.

5. Then add the following code to the code, call the webservice, get the data returned by the interface, and present it.

6. The interface returns data in xml format, and the weather forecast of China and Beijing can be obtained with little parsing.