1.参考:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_WhatsNew.html
得知,当前用的,虽然不是最新的2011-08-02:
【记录】寻找AWSECommerceService的最新版本
但是,是比较新的,2011-08-01,其已经如上所述:
New Marketplace
The IT (Italy) and CN (China) marketplaces were added.
1 August 2011
即,已经支持CN了。
2.用了默认的US的.com:
private static void cn_browseNodeLookupTest()
{
string _awsApiVersion = "2011-08-01";
string _awsDestination_cn = "ecs.amazonaws.com";
SignedRequestHelper helper_cn = new SignedRequestHelper(
awsAccessKeyId,
awsSecretKey,
awsAssociateTag,
_awsDestination_cn);
/*
* Here is an ItemLookup example where the request is stored as a dictionary.
*/
IDictionary
reqDict["Service"] = "AWSECommerceService";
reqDict["Version"] = _awsApiVersion;
reqDict["Operation"] = "BrowseNodeLookup";
//http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html
//for CN: Appliances -> 80207071
reqDict["BrowseNodeId"] = "80207071";
reqDict["ResponseGroup"] = "BrowseNodeInfo";
/*
* The helper supports two forms of requests - dictionary form and query string form.
*/
String requestUrl;
requestUrl = helper_cn.Sign(reqDict);
//WebRequest request = HttpWebRequest.Create(requestUrl);
//WebResponse response = request.GetResponse();
//XmlDocument doc = new XmlDocument();
//doc.Load(response.GetResponseStream());
XmlDocument xmlDoc = new XmlDocument();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUrl);
req.Method = "GET";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr;
string charset = "UTF-8";
Encoding htmlEncoding = Encoding.GetEncoding(charset);
sr = new StreamReader(resp.GetResponseStream(), htmlEncoding);
string respHtml = sr.ReadToEnd();
sr.Close();
resp.Close();
xmlDoc.LoadXml(respHtml);
System.Console.WriteLine(xmlDoc.InnerXml);
}
返回xml是:
AWS.InvalidParameterValue
即,和预期的一样,是无效的id。
3.又去试了试,用.cn的:
private static void cn_browseNodeLookupTest()
{
string _awsApiVersion = "2011-08-01";
string _awsDestination_cn = "ecs.amazonaws.cn";
SignedRequestHelper helper_cn = new SignedRequestHelper(
awsAccessKeyId,
awsSecretKey,
awsAssociateTag,
_awsDestination_cn);
/*
* Here is an ItemLookup example where the request is stored as a dictionary.
*/
IDictionary
reqDict["Service"] = "AWSECommerceService";
reqDict["Version"] = _awsApiVersion;
reqDict["Operation"] = "BrowseNodeLookup";
//http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html
//for CN: Appliance