User220959680 posted
What's next ?
Adding the service reference creates proxy classes to interact with the service. This is done behind the scenes by Visual Studio.
In order to consume the service
1. Create an instance of <ServiceClient> ,
Note that it can be ContentServiceClient
2. Pass user name and password :
Note: check the service prodiver what type of security is enabled to access the service.
3. Access the service method
When all the steps put together client accessing the service is similar to the below.
ContentServiceClient proxy = new ContentServiceClient();
proxy.ClientCredentials.Username.Username = "<username>";
//check with the service provider what type of authentication is implemented in the service
//Also whether the service requires Both (username, password) or just the username.
proxy.ClientCredentials.Username.Password = "<password>";
//Access the service method
var xmlData = proxy.GetData();
//loop through the xmlData and read data
XmlDocument _doc = new XmlDocument( );
_doc.LoadXml(xmlData);
XmlNodeList _firstName = _doc.GetElementsByTagName( "FirstName" );
XmlNodeList _lastname = _doc.GetElementsByTagName( "LastName" );
//read the xmlNode text to string variable
strFirstName = _firstName.InnerText;
//same for the rest