Last post Jul 26, 2016 05:29 PM by march11
Jul 26, 2016 08:48 AM|Jmurekezi|LINK
I am looking for some advice on how I can do a piece of work I have. Basically I have multiple webservice that takes the same methods and parameters. And it is a pain to always have to get proxy classes, and change the code when a new provider is accepted
and I am looking at ways to be able to add the webservice URL in my config and at runtime, be able to compile generate proxy classes and communicate with the remote machine dynamically.
As an example: I have to send data to a method Called UpdateCustomers (int id, string name,string surname,DateTime DateofBirth) to a provider and if We decide to use provider A be able to change the webservice url in config to point to A, or when we decide
to change to B etc...
I am looking for hint and advice.
Jul 26, 2016 05:29 PM|march11|LINK
As long as you can build and maintain the list of providers A, B, etc. then it should be nothing more than a condition statement as to which proxy to connect to.
Do you have the ability to select the provider when submitting the call to the method UpdateCustomer?
If so, simply change the proxy request on that parameter...
Dim returnVal as Type ' Assume each service returns the same type/ if not Dim up your unique value for each.
If providerA then
returnVal = connectProxyProviderA
ElseIf providerB then
returnVal = connectProxyProviderB
ElseIf providerC then
' returnVal = connectProxyProviderC
Dim wsProvA as New webServiceName.EndpointA
Dim wsProvB as New webServiceName.EndpointB