我有以下代码连接到 Web 服务并查询 API 以获得成功的结果。但我面临两个问题
我无法捕获 XML 格式的响应。
我无法从页面重定向回返回 URL。
请帮助 TIA
字符串网址 = "";
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();