C# c上的距离矩阵服务#
如何通过c#使用距离矩阵服务 或者在哪里可以获取wsdl文件以将其上载到soap 唯一的方法是用js展示他们的例子 距离矩阵网站:C# c上的距离矩阵服务#,c#,web-services,google-maps-api-3,C#,Web Services,Google Maps Api 3,如何通过c#使用距离矩阵服务 或者在哪里可以获取wsdl文件以将其上载到soap 唯一的方法是用js展示他们的例子 距离矩阵网站: 该服务似乎是基于REST的,因此最简单的方法是使用WebClient下载内容: WebClient client = new WebClient(); Stream stream = client.OpenRead("http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Vancouver+BC
该服务似乎是基于REST的,因此最简单的方法是使用WebClient下载内容:
WebClient client = new WebClient();
Stream stream = client.OpenRead("http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Vancouver+BC&mode=bicycling&language=fr-FR&sensor=false");
现在您得到了一个包含XML结果的流
您可以使用XmlSerializer将XML解码为代码,也可以使用XDocument.Load将其加载到XDocument中,您可以使用一些DOM遍历或XPath查询来获取所需的数据:
XDocument doc = XDocument.Load(stream);