We are using the PayPal Pro service and they have two different WSDLs, one for testing (sandbox) and one for production (live). They are located at two different urls but have the exact same definition, as of now at least.
We are using C# 4.0 and consuming them as a Service Reference in our back-end class library. Then our web application makes as normal to the back-end in order to process payment.
Our issue is how to handle switching between definitions and endpoint locations? We would like to be able to set some web.config app key value to determine if its should use the Test (sandbox) WSDL or the live WSDL but not sure how to do this.
It seems that we should be able to handle the endpoint as a config value and grab that when we build a request. So I guess are main issue is understanding how to use the definitions themselves. We want to just use one instance of a payment class and method(s) to make the calls but when we "import" both namespaces, there is ambiguity because they are same definition. As such:
Doesn't really make sense to do it this way anyways. So if we can't import both namespaces for the two different WSDLs it seems are choices are one of the following:
1. Create separate classes/methods and detect in the calling method which one to call. Our issue here is we don't want redundant classes/methods.
2. Or just use one of the definitions since they are the same and call different endpoints. Our issue here is there must be a reason there are separate WSDL locations.
Neither of these sound like a great solution. Anybody have any ideas? This can't be that unusual of a scenario where an external company has different WSDL definition locations for different environments.