I am faced with a situation where I have over 200 service URLs that follow a specific format:
serviceURL = DomainName + MethodName + Path;
The DomainName and MethodNames can be configured, while the path may consist of elements such as Param1, Param2, and Param3 like this:
Path = 'A' + '/' + Param1 + '/' + 'B' + '/' + Param2 + '/' + 'C' + '/'+ Param3;
My goal is to develop a versatile method that allows me to input a single URL with parameters, and then automatically sets the serviceURL based on that input. For example:
Var URL = 'domain1/method1/A/{0}/B/{1}/C/{2}';
GenericMethod(URL, Param1, Param2, Param3){
//Replace domain1 with DomainName
//Replace method1 with MethodName
//Replace {0}, {1}, {2} in the URL with the corresponding params
}
Has anyone encountered a similar need before?
Any suggestions are welcome.
Thank you