我有下面的代碼連接到web服務並查詢API以獲得成功的結果。但我面臨兩個問題獲取來自restful webservice的回覆
我無法捕獲XML格式的響應。
我不能從頁面重定向到返回URL。
請幫助TIA
字符串URL = 「」;
string Method = "";
string Group = "";
string FormName = "";
string return_url = "";
Url = "https://abc.com/ws/";
Method = "getRates";
Group = "rates";
FormName = "form1";
return_url = "~/app/Public/PaymentTest.aspx?DR={DR}";
NameValueCollection FormFields = new NameValueCollection();
FormFields.Add("username", "xxx");
FormFields.Add("password", "xxxx");
FormFields.Add("pin", "xxxx");
FormFields.Add("dest_country", "Kenya");
FormFields.Add("return_url", return_url);
Response.Write("<html><head>");
Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, "post", Url + Group + "/" + Method));
for (int i = 0; i < FormFields.Keys.Count; i++)
{
Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", FormFields.Keys[i], FormFields[FormFields.Keys[i]]));
}
Response.Write("</form>");
Response.Write("</body></html>");
Response.End();