Reputation: 491
I have a 3rd party web service to call from ASP.NET Web API application. This 3rd party service is not svc or asmx. And all I have been give is 2 WSDLs for TEST and PROD environments.
https://test.xyz.com/XYZEventService?wsdl
https://xyz.com/XYZEventService?wsdl
Now, I plan to add a class library to my Web API application and have the service references for these services generated through svcutil.exe
.
But how do I differentiate between TEST and PROD? Or in an ideal situation would one proxy work for both?
My question is about the best way to configure and use multiple environment 3rd party web services within a single Web API application.
Upvotes: 4
Views: 2382
Reputation: 6026
In essence, one proxy will work with both.
You could create your reference to the TEST service which would make the appropriate changes to your web.config. There would be a section in your web.config that references the TEST service URL.
Then, in your web.Release.config, you could just make the changes for the service to point to the PROD service instead.
Running in Debug will reference the TEST service, and then when you deploy, the URL will be updated so the Release version will point to the PROD service.
Your website will work fine with you changing the address in the web.config.
Upvotes: 0