Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am writing to write an application (winform) that will consume a webservice to retrieve countries names, within the webservice I found CdCountry class and GetCountryCode function, as seen below. How do I call the GetCountryCode to return the countries.

private void button1_Click(object sender, EventArgs e)
{

WebReference1.EDIWebService client = new WebReference1.EDIWebService();


}


(Note: below code copied from WebReference1)
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PersistBaseOfCdCountry))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CdCountry))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34234")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.xyz.com/abc/")]
public abstract partial class RetrieveBaseOfCdCountry {
}

/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CdCountry))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34234")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.xyz.com/abc/")]
public abstract partial class PersistBaseOfCdCountry : RetrieveBaseOfCdCountry {
}

public partial class CdCountry : PersistBaseOfCdCountry {

private string countryIdField;
private string countryNameField;
private string nationalityField;

public string CountryId {
get {
return this.countryIdField;
}
set {
this.countryIdField = value;
}
}

public string CountryName {
get {
return this.countryNameField;
}
set {
this.countryNameField = value;
}
}

public string Nationality {
get {
return this.nationalityField;
}
set {
this.nationalityField = value;
}
}
}

public CdCountry[] GetCountryCode(string OperatorID, string SecurityKey) {
object[] results = this.Invoke("GetCountryCode", new object[] {
OperatorID,
SecurityKey});
return ((CdCountry[])(results[0]));
}
Posted
Updated 19-Jan-15 4:59am
v3
Comments
Richard MacCutchan 18-Jan-15 11:35am    
Sorry, but this site does not provide code to order.

1 solution

Below are few articles talking about same scenario:
Consuming Web Services from a Win Forms Application[^]

Webservice with Win Forms and Web Forms[^]

http://stackoverflow.com/questions/15963032/calling-methods-from-an-asmx-web-service-error[^]

Hope with those you will be able to implement desired functionality.
Thanks.
 
Share this answer
 
Comments
LSOP 20-Jan-15 11:17am    
Thanks, after reading through those articles I still don't know how to call and return data from GetCountryCode web methods.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900