Friday, 26 December 2014

Can't get desired output when extracting data from WSDL(xml format)



I am trying to get some data from this WSDL file(xml format) "http://ift.tt/1vhBy9z", for example, the value of wsdl:service name, which is CinemaData. Not getting any value with this code:



static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();

doc.Load(@"C:\wsdl\0_Argentina_CinemaData.wsdl");

XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
//nsmgr.AddNamespace("soap", "http://ift.tt/144WdrN");
//nsmgr.AddNamespace("tm", "http://ift.tt/1vhBy9F");
//nsmgr.AddNamespace("soapenc", "http://ift.tt/1kALavD");
//nsmgr.AddNamespace("mime", "http://ift.tt/144WdrR");
//nsmgr.AddNamespace("tns", "http://ift.tt/1vhBypV");
//nsmgr.AddNamespace("s", "http://ift.tt/tphNwY");
//nsmgr.AddNamespace("soap12", "http://ift.tt/144WcnI");
//nsmgr.AddNamespace("http", "http://ift.tt/1vhBAyh");
//nsmgr.AddNamespace(String.Empty, "http://ift.tt/1vhBypV");
nsmgr.AddNamespace("wsdl", "http://ift.tt/1hl0YMI");


XmlNodeList SNameNodes = doc.DocumentElement.SelectNodes("//wsdl:definition/wsdl:service", nsmgr);

List<serviceName> snList = new List<serviceName>();

foreach (XmlNode node in SNameNodes)
{
System.Console.WriteLine("The service name is " + node.Attributes["name"].Value);
}
}

No comments:

Post a Comment