400: Bad Request for Virtual Earth Web Service

I’ve been getting quite a few messages about this “400: Bad Request” error people are seeing when trying to reference the Virtual Earth Web Service, more specifically when trying to fetch tokens so it’s worth posting a little something on how to fix it. Specifically, the error is, “There was an error downloading ‘http://staging.common.virtualearth.net/find-30/common.asmx’. The request failed with HTTP status 400: Bad Request.

The current documentation in the SDK shows a reference to https://staging.common.virtualearth.net/find-30/common.asmx; however, users aren’t getting the WSDL downloaded (I’ve had this problem myself). So, the solution is to change the reference to https://staging.common.virtualearth.net/find-30/common.asmx?wsdl.

In Visual Studio 2008, you’ll need to take a (odd) extra step. For some reason adding a Web Reference is different when you go to the “Add Service” advanced options than if you were to just Add Web Reference from Website menu. So, in Visual Studio 2008…

  1. Select the “Add Service Reference…” item from the Website menu.
  2. Click on the “Advanced…” button.
  3. Click on the “Add Web Reference…” button.
  4. Enter http://staging.common.virtualearth.net/find-30/common.asmx?wsdl for the URL and then hit the “Go” button.
  5. When prompted, enter your Virtual Earth Developer Account ID and password.
  6. Once WSDL has been downloaded, give the web reference a meaningful name like “TokenService” then click the “Add Reference” button.

This should fix your issues. We’ll be updating the SDK soon too.


Share on twitter Share on facebook Share on linkedin Share on linkedin