エラーが返され、リクエストのエンコード方法について受け取った API マニュアルに従っています。以下は私の要求です..
string url = "[My url to send request to]";
string xmlrequest = "<serv_request><head><securityContext><account>[account]</account><key>[my account key]</key></securityContext></head><body><username>[my user name]</username></body></serv_request>";
NameValueCollection nvc = new NameValueCollection();
nvc.Add("xml", Server.UrlEncode(xmlrequest));
WebClient client = new WebClient();
byte[] byteresponse = client.UploadValues(url, nvc);
string xmlresponse = client.Encoding.GetString(byteresponse);
エラーで応答が返ってきます。ドキュメントのトップ レベルでは無効です。
編集..私に提供されたAPIマニュアルからの指示を追加..
string url = " http://[domain_name]/_gateway/api/[filename].asp";
// formulate the XML request here
string xmlrequest = "<serv_request>...</serv_request>";
NameValueCollection nvc = new NameValueCollection();
nvc.Add("xml", Server.UrlEncode(xmlrequest));
WebClient client = new WebClient();
byte[] byteresponse = client.UploadValues(url, nvc);
string xmlresponse = client.Encoding.GetString(byteresponse);