You can use this class. I donβt remember where I found the base code, I added some methods and converted to a class before.
public class WebService { public string Url { get; set; } public string MethodName { get; set; } public Dictionary<string, string> Params = new Dictionary<string, string>(); public XDocument ResultXML; public string ResultString; public WebService() { } public WebService(string url, string methodName) { Url = url; MethodName = methodName; }
And you can use this as
WebService ws = new WebService("service_url", "method_name"); ws.Params.Add("param1", "value_1"); ws.Params.Add("param2", "value_2"); ws.Invoke();
source share