概述
<soapenv:Envelope xmlns:imp="http://imp.bank.ws.manager.cdxt.com/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body><imp:GetRegDateList><arg0><Request><DistrictId></DistrictId><RegDate>2021-09-12</RegDate><OrgId></OrgId><UserId>pufa001</UserId></Request></arg0></imp:GetRegDateList></soapenv:Body></soapenv:Envelope>
public static string GetSOAPReSource(string url, string strMethodName, Hashtable Pars)
{
try
{
XmlDocument doc = new XmlDocument();
XmlElement root = (XmlElement)doc.AppendChild(doc.CreateElement("soapenv", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/"));
root.SetAttribute("xmlns:imp", "http://imp.bank.ws.manager.com/");
XmlElement header = (XmlElement)root.AppendChild(doc.CreateElement("soapenv", "Header", "http://schemas.xmlsoap.org/soap/envelope/"));
XmlElement soapBody = (XmlElement)root.AppendChild(doc.CreateElement("soapenv", "Body", "http://schemas.xmlsoap.org/soap/envelope/"));
XmlElement soapMethod = (XmlElement)root.AppendChild(doc.CreateElement("imp", strMethodName, "http://imp.bank.ws.manager.com/"));
foreach (string k in Pars.Keys)
{
XmlElement soapPar = doc.CreateElement(k);
soapPar.InnerXml = ObjectToSoapXml(Pars[k]);
soapMethod.AppendChild(soapPar);
}
soapBody.AppendChild(soapMethod);
doc.DocumentElement.AppendChild(soapBody);
Uri uri = new Uri(url);
WebRequest webRequest = WebRequest.Create(uri);
webRequest.ContentType = "text/xml; charset=utf-8";
webRequest.Method = "POST";
using (Stream requestStream = webRequest.GetRequestStream())
{
byte[] paramBytes = Encoding.UTF8.GetBytes(doc.InnerXml);
requestStream.Write(paramBytes, 0, paramBytes.Length);
}
WebResponse webResponse = webRequest.GetResponse();
using (StreamReader myStreamReader = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8))
{
string result = "";
return result = myStreamReader.ReadToEnd();
}
}
catch (Exception ex)
{
throw ex;
}
}
<Response><ResultCode>0</ResultCode><ResultMsg>成功</ResultMsg><Item><RegDate>2021-09-12</RegDate><RegWeekDay>星期日</RegWeekDay></Item><Item><RegDate>2021-09-13</RegDate><RegWeekDay>星期一</RegWeekDay></Item><Item><RegDate>2021-09-14</RegDate><RegWeekDay>星期二</RegWeekDay></Item><Item><RegDate>2021-09-15</RegDate><RegWeekDay>星期三</RegWeekDay></Item><Item><RegDate>2021-09-16</RegDate><RegWeekDay>星期四</RegWeekDay></Item><Item><RegDate>2021-09-17</RegDate><RegWeekDay>星期五</RegWeekDay></Item><Item><RegDate>2021-09-18</RegDate><RegWeekDay>星期六</RegWeekDay></Item><Item><RegDate>2021-09-19</RegDate><RegWeekDay>星期日</RegWeekDay></Item></Response>
最后
以上就是酷酷夕阳为你收集整理的c# 获取JAVA WSDL 接口数据 soap:Envelope的全部内容,希望文章能够帮你解决c# 获取JAVA WSDL 接口数据 soap:Envelope所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复