I have an issue. My boss has setup a test SOAP web service that he wants use to consume in our API. Originally we only had one, so it was straight forward enough. Now we have two and they are on different endpoints, so I created 2 Web References that look like this:
We are using autofac and I was able to register the service like this:
builder.RegisterType<webServices>().As<webServices>().InstancePerDependency();
I was going to create a factory class to switch between the two, but the issue I have is that even though they are both a webServices
class, they are on different name spaces and do not have an interface or anything.
The only thing I could find was that they both inherit from System.Web.Services.Protocols.SoapHttpClientProtocol
, but registering that would lose any of the public methods which I need.
Does anyone know or can think of any suggestions that might help me get around this issue? Basically I want one class to switch between the two depending on if we are live or not, we currently have a flag in a config file for that.