I wrote a web service. I wrote a website. I want the website BLL code to call the web service.
I have a configuration table with this service url. I am embedding the web service url in the calling code. Which web client or socket in C # should I use that can receive a dynamic web service URL?
I thought to use:
WebClient webClient = new WebClient(); UTF8Encoding response = new UTF8Encoding(); string originalStr = response.GetString(webClient.DownloadData(BLLConfig.Current);
But maybe there is a more elegant way?
I load configurations at runtime from a DB table.
This is how I tried using the web link in Visual Studio:
using (var client = new GetTemplateParamSoapClient("GetTemplateParamSoap")) { TemplateParamsKeyValue[] responsArray = client.GetTemplatesParamsPerId(CtId, tempalteIds.ToArray()); foreach (var pair in responsArray) { string value = FetchTemplateValue(pair.Key, pair.Value); TemplateComponentsData.Add(pair.Key, value); } }
source share