Connect to Salesforce using wsdl in Drupal 8 I am trying to connect to Salesforce (SF) with wsdl to pull data.

I can't use SF suite module or Salesforce rest client service.

In the D7 file, I have:

require_once ('soapclient/SforceEnterpriseClient.php');
require_once('soapclient/SforceHeaderOptions.php');
ini_set("soap.wsdl_cache_enabled", "0");

$sfdc = new SforceEnterpriseClient();
$SoapClient = $sfdc-&gt;createConnection($curPath.'/enterprise.wsdl');


It create the connections without any problems.

D7 References from here: https://developer.salesforce.com/page/PHP_Toolkit_11.0_Getting_Started and learned to how to use it from here: https://github.com/developerforce/Force.com-Toolkit-for-PHP/blob/master/soapclient/SforceEnterpriseClient.php

In the D8, I am trying to figure out how to connect to SF in the same way:

namespace Drupal\mymodule\Controller\Soapclient;
$sfdc = Soapclient::SforceEnterpriseClient();
$SoapClient = $sfdc-&gt;createConnection('../../includes/soapclient/enterprise.wsdl');


But got the SforceEnterpriseClient class not found error.

Stuck on it for a while, any help will be so much appreciated.
Anybody knows how to connect to SF in the same way like this:https://github.com/developerforce/Force.com-Toolkit-for-PHP/blob/master/soapclient/SforceEnterpriseClient.php
It seems the problem you are facing is due to the way you are referring the library; please refer the following question; they have explained how you should be using external libraries in Drupal 8 custom modules.