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
Joona Heikkinen@m-files.comJoona Heikkinen@m-files.com 

Client configuration endpoint element sforce.Soap not found

Hello,

I am writing a Windows application which uses the SOAP API to connect to SalesForce, for example to read and update some object. I have followed the various instructions on www.salesforce.com and based my code on the following C# examples:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_steps_walk_through_code.htm

I am currently using the .NET3.0 SoapClient services approach (third and last code example on the page above). When the execution reaches at line 052 loginClient = new SoapClient(); the following exception is thrown: 

System.InvalidOperationException: Could not find default endpoint element that references contract 'sforce.Soap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

This sounds like I have a problem in my app.config file, but this configuration was autogenerated when I added the "sforce" service reference in Visual Studio 2015, based on the enterprise wsdl.jsp.xml file that is generated from SalesForce for our own database.

The serviceModel section in the generated app.config file looks like this:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="SoapBinding">
          <security mode="Transport" />
        </binding>
        <binding name="SoapBinding1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://login.salesforce.com/services/Soap/c/39.0/0DF41000000O0XX"
        binding="basicHttpBinding" bindingConfiguration="SoapBinding"
        contract="sforce.Soap" name="Soap" />
    </client>
  </system.serviceModel>

Looking around the web and this forum in particular, it doesn't seem to me that there is an error in this app.config file, so why do I get the exception, and most importantly how do I fix this problem?

Thanks.
Joona Heikkinen@m-files.comJoona Heikkinen@m-files.com
Has anyone encountered the same error? This problem is persisting and is for us a SHOWSTOPPER. We cannot integrate and use the SOAP API at all in our external applications to communicate with SalesForce until we find a way to prevent the exception being thrown.
Matt TomsMatt Toms
I'm having this problem too. Did you find a solution?