Soapui请求结果集
地址栏获得的接口地址
如http://192.168.1.103/wstopprd/ws/r/awsp900?Wsdl
访问接口地址为http://192.168.1.103/wstopprd/ws/r/awsp900
查看方法:
下面附上请求代码:
string URL = "http://192.168.1.103/wstopprd/ws/r/awsp900";
//创建请求
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);
//创建头部信息
request.Method = "POST";
request.ContentType = "text/xml; charset=utf-8";
//具体请求查看soapui中的头部信息
request.Headers.Add("SOAPAction", "");这个为必填
//具体报文格式询问创建接口的开发
StringBuilder sb = new StringBuilder();
sb.Append("
//Sb为请求报文
//转为字节数组
byte[] data = System.Text.Encoding.ASCII.GetBytes(sb.ToString());
//获得字节长度
request.ContentLength = data.Length;
//开始请求
Stream writer = request.GetRequestStream();
writer.Write(data, , data.Length);
writer.Close();
// 回执信息
//using (var response = request.GetResponse())
using (WebResponse response = request.GetResponse()){
XmlDocument doc = new XmlDocument();
StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
//读取回执信息
string retXml = sr.ReadToEnd();
sr.Close();
//解析XML找到对应节点
doc.LoadXml(retXml);
var xmlStr = doc.SelectSingleNode("//response").ChildNodes[].InnerText;
手机扫一扫
移动阅读更方便
你可能感兴趣的文章