Generating Client Proxy Classes

 

This documentation is no longer available on MSDN. It is available as a CHM or PDF download. For the newest Geocoding, Imagery, Routing and Traffic services, see Bing Maps REST Services. 

The Bing Maps SOAP Services metadata define the format of messages that Bing Maps SOAP Services send and receive. The service metadata URLs are outlined in the Bing Maps SOAP Services Addresses topic. To make requests to the Bing Maps SOAP Services, you need to generate proxy classes on your client so that requests can be constructed that are understood by Bing Maps.

Using the ServiceModel Metadata Utility Tool

Bing Maps SOAP Services are a set of web services built using Windows Communication Foundation (WCF) (https://msdn.microsoft.com/en-us/library/ms735119.aspx). The Bing Maps SOAP Services conform to WS-Basic Profile 1.1 (https://www.ws-i.org/Profiles/BasicProfile-1.1.html). It is highly recommended that you use the Service Model Metadata Utility Tool (svcutil.exe) or Visual Studio 2008 to generate the service proxy classes for the Bing Maps SOAP Services. Svcutil.exe can be downloaded from https://msdn.microsoft.com/en-us/library/aa347733.aspx or from the main menu in the Visual Studio 2008 user interface, select Project, then Add Service Reference. The Bing Maps SOAP Services metadata URLs are listed in the Bing Maps SOAP Services Addresses topic.

If you are planning on using more than one of the services (for example, if you want to geocode an address and then retrieve a static map showing that address), use svcutil.exe to generate a single source file that contains service proxy classes for all of the Bing Maps SOAP Services as shown below.

svcutil.exe /target:code /language:csharp /out:VirtualEarthWebServices https://dev.virtualearth.net/webservices/v1/searchservice/searchservice.svc?wsdl https://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl https://dev.virtualearth.net/webservices/v1/imageryservice/imageryservice.svc?wsdl https://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc?wsdl 

rem  The VirtualEarthWebServices.cs file contains the proxy classes that have been generated. Add this file to your Visual Studio project. The App.config file contains configuration settings.

Other Tools

If you are developing your application in Visual Studio and want to instead use the wsdl.exe command-line utility or the Add Web Reference menu item in the user interface, you need to set the corresponding xxxSpecified member to true for each member that is being set to enable the serialization of those members. More information about this can be found at https://blogs.msdn.com/eugeneos/archive/2007/02/05/solving-the-disappearing-data-issue-when-using-add-web-reference-or-wsdl-exe-with-wcf-services.aspx