Jul 7, 2009

Bing maps web service weirdness

I’ve experienced some interesting issues with the Bing Maps web services, specifically the token service. Looks like it’s been a problem for some folks, and this time Google produced no conclusive results.

The symptoms are that despite entering your account id and password correctly you cannot add a Web Service reference from VS 2008. You get an error message similar to this:

There was an error downloading 'https://staging.common.virtualearth.net/find-30/common.asmx?wsdl'.
The request failed with HTTP status 400: Bad Request.

I’ve tried this on several machines with the same result. Hitting the site via IE works fine. Normally you have the option of using wsdl.exe/svcutil.exe and generating your proxy and this is what I normally use for web services. In this case that doesn't work well since my project is a Compact Framework project. The usual tools don’t seem to do the job, there is no switch that allows to specify the target framework as Compact Framework.

The trick that worked for me was to download the .wsdl as common.wsdl and serve this file from my Web Development Server. Once this is set up, you can go ahead and add the Web Service reference from VS and point to this locally hosted common.wsdl. This should allow you to generate a web service proxy for the token service.