1

I am consuming a third party webservice in C#.net and I have generated a reference to it using the wsdl provided. Now, the third party has different environments and the namespaces in each are depending on the environment eg:

prod https://prod.company.net/api/B2b/
staging: https://stage.company.net/api/B2b/
dev : https://dev.company.net/api/B2b/

The reference that I had generated was based on the wsdl in staging and now I need to modify my Reference.cs to the production namespace. Is there a way to avoid this modification to Reference.cs everytime I deploy to either production or staging/dev.

TL;DR Different namespaces in each environment are giving me nightmares.

user2260040
  • 1,275
  • 1
  • 13
  • 26
  • Possible duplicate of [Best way to manage multiple Service References in .NET](https://stackoverflow.com/questions/23330435/best-way-to-manage-multiple-service-references-in-net) – jtabuloc May 14 '19 at 04:15
  • If that's the only difference between them then a powershell step in your release to do a search and replace should do the trick. – tom redfern May 14 '19 at 13:59
  • That's what I have been doing... but it gets annoying after a while. I do think that the approach by third party is not the correct way to define namespace. – user2260040 May 14 '19 at 21:13
  • Are you sure it is the namespaces that differ, and not the service URLs? It's highly unusual to have a different namespace per environment. – John Wu May 14 '19 at 22:03
  • Exactly my dilemma. If the service URL's were different, I could easily handle them by having a setting in the config file for different environments and point to appropriate URL. – user2260040 May 14 '19 at 22:05
  • here is a similar question that never got an answer... https://stackoverflow.com/questions/46648642/return-correct-client-for-wsdl-based-on-condition-same-client-but-different-na – user2260040 May 16 '19 at 03:15

0 Answers0