wcf服务消耗 [英] wcf service consuming

查看:70
本文介绍了wcf服务消耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wcf服务,因此我正在得到

i am using wcf service,in this i am getting

result = "true"



将此值转换为一个字符串变量结果,我只需要读取该值为true的值即可.
我该怎么做才能帮助我...

我以xml的形式获取但没有xml文件名...



this value ,into one string variable result,i need to read only that value that is true.
how can i do this pls help me...

i am getting in the form of xml but not having xml file name...

推荐答案

我从您的问题中了解到,您正在调用WCF服务,该服务正在返回其中具有结果"节点的XML字符串.并且您想从XML字符串中读取结果"节点的值.

请尝试以下代码.
What I understood from your Question is, You are calling WCF service which is returning XML string having "result" node in it. And you want to read value of "result" node from XML string.

Try as below code.
string strXmlFromWCF="YourResultXMLFromWCF";//Initialize with your WCF Call.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(strXmlFromWCF);

System.Xml.XmlNode resultNode = doc.SelectSingleNode("result");

string result = resultNode.InnerText;



替代解决方案-



Alternate Solution -

string strXmlFromWCF="YourResultXMLFromWCF";//Initialize with your WCF Call.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(strXmlFromWCF);

string result = doc.DocumentElement.InnerText


这篇关于wcf服务消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆