Bing

400: Bad Request for Virtual Earth Web Service

October 16, 2008, 04:43 PM by Chris Pendleton | 9 Comments

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.

CP

subscribe

Comments

Anonymous

Posted On October 30, 2008, 05:11 PM

If you want to create a CS file using a WSDL utility, make sure you include your user name and password, otherwise you’ll get the same ‘400: Bad Request’ error:

wsdl.exe /l:CS /n:StagingVEToken /u:USERNAME /p:PASSWORD /out:bin/StagingVEToken.cs https://staging.common.virtualearth.net/find-30/common.asmx?wsdl


Bob

Posted On June 20, 2009, 09:10 AM

Just a note, that work around doesn't appear to work for me.


shine_show

Posted On June 23, 2009, 06:13 PM

With VS NET 2010,can I add the Reference?


shine_show

Posted On June 23, 2009, 06:13 PM

With vs net 2010, can i add the reference?


Chris Pendleton

Posted On June 23, 2009, 08:44 PM

Yes - this is fixed in VS 2010.

CP


RichGio

Posted On August 02, 2009, 10:40 PM

I'm getting the same "400" error, after applying all of the suggestions above.

The URL I'm using is:

staging.common.virtualearth.net/.../common.asmx

and my IDE is VS 2005.

Though I receive this error, and thus cannot name the Web reference nor click the [disabled] Add Reference button, I do see six methods listed in the 'description' multi-line text box below the URL field. They are GetClientToken, GetCountryRegionInfo, GetDataSourceInfo, GetEntityTypes, GetGreatCircleDistances, and GetVersionInfo.

Also, I tried adding the above URL to the Trusted Sites along with this 2nd URL:

common.virtualearth.net/.../common.asmx

Still getting the error.

Please help, thanks.


Chris Pendleton

Posted On August 02, 2009, 11:40 PM

No fun in VS 2005. You have to create your own proxy. Details here: msdn.microsoft.com/.../cc980833.aspx.

CP


Links of London

Posted On August 05, 2009, 05:51 AM

Bing is  a  really  overlord!!    support Bing~~


Christopher Robin

Posted On September 05, 2009, 02:11 AM

No joy for me either with the work around.

VS2008, SL3.0


Welcome

to the Microsoft Bing community

Remember, don't post your personal information!