Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have asp.net application.
I need to consume a web-service url from config files.

But I have three environments with 3 different urls like below

http://test/webservice
http://qa/webservice
http://prod/webservice

how to call this in different config files with same service name might be.

What I have tried:

thinking to work with uri address need to change dynamica or direct name in config files
Posted
Updated 28-Jul-17 2:52am
v2
Comments
F-ES Sitecore 26-Jul-17 5:57am    
google config transformations, you might be able to solve this by having different build targets and changing the base url of the api in the config files.
gampapraveen 26-Jul-17 7:18am    
we have multiple config files but not the transformation files.

1 solution

My idea is, you can create a class for manage the 3 webservice. Then you add your webservice with Add/Service Reference and then in the new class you can create all the functions for management the 3 webservice.

In your project only need create one object and call the functions in all the webservices.

C#
public class WebService 
{
   #region webservice1
   //functions
   #endregion
   #region webservice2
   //functions
   #endregion
   #region webservice3
   //functions
   #endregion
}

public void GetNames()
{
   WebService ws = new WebService();
   string[] names1 = ws.webservice1_GetNames();
   string[] names2 = ws.webservice2_GetNames();
   string[] names3 = ws.webservice3_GetNames();
}

I hope I can help you.
Happy codding
 
Share this answer
 

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