我是靠谱客的博主 酷酷夕阳,最近开发中收集的这篇文章主要介绍c# 获取JAVA WSDL 接口数据 soap:Envelope,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

   <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>&lt;Request&gt;&lt;DistrictId&gt;&lt;/DistrictId&gt;&lt;RegDate&gt;2021-09-12&lt;/RegDate&gt;&lt;OrgId&gt;&lt;/OrgId&gt;&lt;UserId&gt;pufa001&lt;/UserId&gt;&lt;/Request&gt;</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所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部