function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Don HobsonDon Hobson 

C# app using two Salesforce WSDLs for integration dev/qa

I am writing a web service where I move data between two SF environments using two different Enterprise WSDL, a web service and C#. I have both WSDLs loaded and if I remove one, I don't have a problem.

 

For example, I want the Accounts in sforce_Enterprise to sync with the accounts in ACMEenterpriseWebRef

 

Environement A: sforce_Enterprise 

Environement B: ACMEenterpriseWebRef

 

I can successfully use each one correctly if the other is commented out. Meaning my C# app can get a list of Accounts from each with web services.

 

While BOTH are enabled\not commented out, I am having the following issues.

 

using ACMEIntegrationConsoleApp.sforce_Enterprise;

using ACMEIntegrationConsoleApp.ACMEenterpriseWebRef;

 

Here is my problem

 

private static SforceService sfdc;

 

 

// Create a service object

sfdc = new SforceService(); <--- Fails

 

// Try logging in

LoginResult lr; <--- Fails

 

Multiple Errors

 

Error 215 'LoginResult' is an ambiguous reference between 'ACMEIntegrationConsoleApp.sforce_Enterprise.LoginResult' and 'ACMEIntegrationConsoleApp.ACMEenterpriseWebRef.LoginResult' C:\Users\Administrator\Documents\Visual Studio 2012\Projects\proservices\src\integration\soap\ACME\csharp\ACMEIntegrationConsoleApp\ACMEIntegrationConsoleApp\Program.cs 236 13 ACMEIntegrationConsoleApp

 

 

This makes sense because both of my WSDLs are from Salesforce, they are just from different Enterprise Orgs.

 

.sforce_Enterprise;

<service name="SforceService"> <documentation>Sforce SOAP API</documentation> <port name="Soap" binding="tns:SoapBinding"> <soap:address location="https://login.salesforce.com/services/Soap/c/27.0/0DFi0000000Gnix" /> </port> </service>

 

ACMEenterpriseWebRef

<service name="SforceService"> <documentation>Sforce SOAP API</documentation> <port name="Soap" binding="tns:SoapBinding"> <soap:address location="https://test.salesforce.com/services/Soap/c/27.0/0DFZ0000000CapT" /> </port> </service>

 

Hopefully this is clear enough for someone to impart their wisdom on me.

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

You have classes with the same name in different pacakges (e.g. wsdlA.LoginResult & wsdlB.LoginResult),if you need to use both types in the same class, then you'll need to use the fully qualified name in your code, e.g. wsdlA.SforceService sfdc = new wsdlA.SForceServices(); wsdlA.LoginResult lr = sfdc.login("foo", "bar");

All Answers

SuperfellSuperfell

You have classes with the same name in different pacakges (e.g. wsdlA.LoginResult & wsdlB.LoginResult),if you need to use both types in the same class, then you'll need to use the fully qualified name in your code, e.g. wsdlA.SforceService sfdc = new wsdlA.SForceServices(); wsdlA.LoginResult lr = sfdc.login("foo", "bar");

This was selected as the best answer
SuperfellSuperfell

Alternatively you could build your integration with the Partner WSDL, which is the same for all orgs, so you'd only need to import it once.

Don HobsonDon Hobson

Simon,

This is what I ended up doing. Visual Studio actually prompted me to help me solve and it helped by choose each one based on the org I was accessing. After that I just ran with it and it is working out fine.