views:

666

answers:

1

i am using a WSDL file to create a the proxy class file, this service has a big Enumeration. the description for each enum value is in documentation section, how can i programatically read that section?

+2  A: 

A WSDL file is always an XML file, so you can open it and read the elements data. For example, given the eBay Services WSDL file, you can query the documentation of the value COD of the enumeration BuyerPaymentMethodCodeType like this:

 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;
Panos
Thank You Man, this should work with a few modifications
Oscar Cabrero