本文整理汇总了C#中Util.SetSoapEnvelopeASMX方法的典型用法代码示例。如果您正苦于以下问题:C# Util.SetSoapEnvelopeASMX方法的具体用法?C# Util.SetSoapEnvelopeASMX怎么用?C# Util.SetSoapEnvelopeASMX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util.SetSoapEnvelopeASMX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestWebServiceButton_Click
protected void TestWebServiceButton_Click(object sender, EventArgs e)
{
Util util = new Util();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
string[] param_values = (string[]) State["WebServiceMethodInputValues"];
string web_service_url = State["WebServiceURL"].ToString();
string method = State["WebServiceMethod"].ToString();
XmlDocument TestDoc = null;
try
{
StringBuilder inputs = new StringBuilder();
for (int i = 1; i <= ParamRepeater.Items.Count; i++)
{
string index = i.ToString();
if (i < 10)
index = "0" + index;
string text = Request.Form.Get("ParamRepeater$ctl" + index + "$paramInput");
inputs.Append("&" + param_values[i - 1] + "=" + text);
}
if (ParamRepeater.Items.Count > 0 && inputs[0] == '?')
inputs.Remove(0, 1);
XmlDocument SoapEnv = new XmlDocument();
if (web_service_url.ToLower().Contains(".php/") || web_service_url.ToLower().EndsWith(".php"))
{
SoapEnv.Load(MapPath(".") + @"\templates\SoapEnvelopeTemplatePHP.xml");
util.SetSoapEnvelopePHP(SoapEnv, web_service_url, method, inputs.ToString());
TestDoc = util.HttpSOAPRequest(State, web_service_url, SoapEnv, null);
}
else if (web_service_url.ToLower().Contains(".asmx/") || web_service_url.ToLower().EndsWith(".asmx"))
{
SoapEnv.Load(MapPath(".") + @"\templates\SoapEnvelopeTemplateASMX.xml");
util.SetSoapEnvelopeASMX(SoapEnv, web_service_url, method, inputs.ToString());
TestDoc = util.HttpSOAPRequest(State, web_service_url, SoapEnv, null);
}
else
throw new Exception("Cannot recognize web service type");
}
catch (Exception ex)
{
util.LogError(State, ex);
TestWebServiceMessage.Text = "Calling the web service return an error: " + ex.Message;
return;
}
State["WebServiceTestDoc"] = TestDoc;
BuildWebServiceDataTrees(WebServiceEvents.SelectedItem.Text);
ResponseMessage.Text = "Expand the nodes for " + State["WebServiceResponseTreeViewNodeText"].ToString();
DataMultiPage.SelectedIndex = 1;
}