You are here

public function SoapClient::connect in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_soap/src/Soap/SoapClient.php \Drupal\salesforce_soap\Soap\SoapClient::connect()
  2. 5.0.x modules/salesforce_soap/src/Soap/SoapClient.php \Drupal\salesforce_soap\Soap\SoapClient::connect()

Establish a connection to the SOAP API.

Overrides SoapClientInterface::connect

1 call to SoapClient::connect()
SoapClient::trySoap in modules/salesforce_soap/src/Soap/SoapClient.php
Salesforce SOAP API resource wrapper.

File

modules/salesforce_soap/src/Soap/SoapClient.php, line 65

Class

SoapClient
A client for communicating with the Salesforce SOAP API.

Namespace

Drupal\salesforce_soap\Soap

Code

public function connect() {
  $this->isConnected = FALSE;

  // Use the "isAuthorized" callback to initialize session headers.
  if (!($token = $this->authMan
    ->getToken())) {
    throw new \Exception('Salesforce needs to be authorized to connect to this website.');
  }
  $this
    ->createConnection($this->wsdl);
  $this
    ->setSessionHeader($token
    ->getAccessToken());
  $this
    ->setEndpoint($this->authMan
    ->getProvider()
    ->getApiEndpoint('partner'));
  $this->isConnected = TRUE;
}