迁移调用webservice的.net wcf项目到.net6,由于转义字符&导致接口不通
//迁移调用webservice的.net wcf项目到.net6,由于webservice地址带转义字符例如&导致接口不通 private void TestWs() { //<?xml version=\"1.0\" encoding=\"utf-8\"?> string xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:asi=\"http://siebel.com/asi/\" ><soapenv:Header><UsernameToken xmlns=\"http://siebel.com/webservices\">LIULL113650</UsernameToken><PasswordText xmlns=\"http://siebel.com/webservices\">LIULL113650</PasswordText></soapenv:Header><soapenv:Body><asi:Hans_spcAccount_spcInfo_spcQuery_spcWF><SearchExpr>[Account.Id]='1-F188GK'</SearchExpr></asi:Hans_spcAccount_spcInfo_spcQuery_spcWF></soapenv:Body></soapenv:Envelope>"; HttpContent content = new StringContent(xml, Encoding.UTF8, "text/xml"); //content.Headers.Add("SOAPAction", "http://tempuri.org/LIS.WS.DHCLISService.GetData"); //content.Headers.Add("UsernameToken", "LIULL113650"); //content.Headers.Add("PasswordText", "LIULL113650"); string result; using (HttpClient client = new HttpClient()) using (var response = client.PostAsync(@"http://172.17.253.70:8080/eai_chs/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&WSSOAP=1", content)) { result = response.Result.Content.ReadAsStringAsync().Result; //创建一个xml文档 XmlDocument xmlDoc = new XmlDocument(); //为文档导入数据 xmlDoc.LoadXml(result); result = xmlDoc.InnerText; } }
迁移调用webservice的.net wcf项目到.net6,由于转义字符&导致接口不通
//迁移调用webservice的.net wcf项目到.net6,由于webservice地址带转义字符例如&导致接口不通private void TestWs(){//<?xml version=\...
点击下载文档
本文2024-09-16 18:37:51发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-23384.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章