【发布时间】:2012-07-24 16:00:49
【问题描述】:
我正在尝试将我的 Bing API 从旧 API 转移到新的 Windows Azure Marketplace
我的代码是这样的:
String serviceUrl = "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/
v1/Web?Query='"+ query+"'";
byte[] accountKeyBytes = Base64.encodeBase64(( bingAzureApiKey + ":" +
bingAzureApiKey).getBytes());
String accountKeyEnc = new String(accountKeyBytes);
URL celebSearchurl = new URL(serviceUrl);
URLConnection urlc = celebSearchurl.openConnection();
urlc.addRequestProperty("Authorization", "Basic "+accountKeyEnc);
urlc.setConnectTimeout(2500);
urlc.setReadTimeout(2500);
但我同样收到 400 错误。 我不明白我在这里做错了什么?
【问题讨论】: