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');
ini_set("soap.wsdl_cache_enabled", "0");

$sfdc = new SforceEnterpriseClient();
$SoapClient = $sfdc->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->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


1 Answer 1


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.

  • I don't think they are connected. What i did in my D7 was download the php files from: developer.salesforce.com/page/PHP_Toolkit and use it but right now they don't have latest php version available yet so should i write my own soapclient class or D8 have some other way to handle it? That's my questions. Thanks in advance.
    – LisaH1110
    Mar 24, 2018 at 18:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.