c# 对SOAP返回XML字符串的解析方法
时间:2019-10-08 15:34:08
收藏:0
阅读:305
示例:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <SalesResponse xmlns="http://timea.org/"> <SalesResult>{"Success":false,"ErrorMessage": {"Message":"E-Operation无此料号.E-Operation无此PO.库存不足,请先增加库存!","Lines":[]}}</SalesResult> </SalesResponse> </soap:Body> </soap:Envelope>
针对以上进行解析,解析代码
try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(agbsresult);//Load加载XML文件,LoadXML加载XML字符串 string value = xmlDoc.DocumentElement["soap:Body"]["SalesResponse"]["SalesResult"].InnerXml; } catch (Exception) { throw; } return value;
原文:https://www.cnblogs.com/ling-cun/p/11635590.html
评论(0)