Thursday 20 December 2012

How do I call a web service through code?

Following the code:_

// Create an XPathNavigator object to navigate the data source of the web service
XPathNavigator nav = DataSources["HelloWorld"].CreateNavigator();

// Set the value of the parameter to pass to the web service
nav.SelectSingleNode("//dfs:queryFields/tns:HelloWorld/tns:name", NamespaceManager).SetValue("myValue");

// Call the web service
DataSources["HelloWorld"].QueryConnection.Execute();

// Retrieve the results returned by the web service
string results = nav.SelectSingleNode("//dfs:dataFields/tns:HelloWorldResponse/tns:HelloWorldResult", NamespaceManager).Value;

No comments:

Post a Comment