我使用WSDL文件来创建代理类文件,这个服务有一个很大的枚举。每个枚举值的描述都在文档部分,我如何才能以编程方式读取该部分?
发布于 2008-10-27 20:25:50
WSDL文件始终是XML文件,因此您可以打开它并读取元素数据。例如,给定eBay Services WSDL file,您可以像这样查询枚举BuyerPaymentMethodCodeType的值COD的文档:
XmlDocument wsdlDoc = new XmlDocument();
wsdlDoc.Load(@"D:\temp\eBaySvc.wsdl");
XmlNamespaceManager nsMgr = new XmlNamespaceManager(wsdlDoc.NameTable);
nsMgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
XmlNode node = wsdlDoc.SelectSingleNode("//xs:simpleType[@name='BuyerPaymentMethodCodeType']/xs:restriction/xs:enumeration[@value='COD']/xs:annotation/xs:documentation", nsMgr);
string description = node.InnerText;https://stackoverflow.com/questions/240720
复制相似问题