How to handle SalesForce WSDL files for sandbox and production sites in ASP.Net?

Posted by Traveling Tech Guy on Stack Overflow See other posts from Stack Overflow or by Traveling Tech Guy
Published on 2009-09-13T18:39:05Z Indexed on 2010/04/05 6:03 UTC
Read the original article Hit count: 336

Filed under:
|
|

I need to authenticate users and get info about them from an ASP.Net application. Since I have 2 sites (sandbox, production) and 2 org IDs - I needed to generate 2 SalesForce WSDL files.

I diffed the 2 files (each about 600kb in size) and while they are 95% the same, there are enough differences strewn all over the place - enough for me to need to use them both. I added both as web references to my solution, and here's where my problem starts.

Obviously, I cannot use both references in the same file, as they contain the same classes/functions. I had to write a quick-and-dirty solution over the weekend, so I just created 2 classes - each using a different web reference - but otherwise the exact functionality, and I use the appropriate one, based on the URL the user is coming from. This works well, but strikes me as a bad (read: quick-and-dirty) solution.

My question: is there any way to do one or more of the following:

  1. change the web reference on the fly?
  2. use both web references in the same file, but put one in a different namespace?
  3. find a better solution to the whole situation? I nd up with a huge XmlSerializer.dll (3mb!) - probably due to using both huge WSDL files.

Thanks for your time.

© Stack Overflow or respective owner

Related posts about wsdl

Related posts about salesforce