This experience will tell us how to invoke the WebService that others have published and what needs to be noted. Now take an example of the interface that gets the weather forecast, because there are no links in the text, so there are webservice linked addresses in the diagram below.
Tools/Materials
- VS2013
- WebService interface
Method/Step
First open the VS2013, select New Project, file--.
Select Console application in the project and rename the project name to "WebServiceTest".
Right-click the project and select Add-service reference.
Enter the Webservie link address in the Address bar and then rename the service name "Servicegetweather" and click OK to see the added service app in your code.
Then add the following code to the code, call WebService, get the data returned by the interface, render it.
This is the result of the operation, you can see that the interface returned an XML format of data, only a little to parse, you can get the weather forecast in Beijing, China.
Some webservice need to be charged.
Original address: http://jingyan.baidu.com/article/8cdccae976342f315513cd71.html
VS2013 How to call a WebService program published by someone else