You are here

function soapclient::soapclient in Salesforce Suite 5

Same name and namespace in other branches
  1. 5.2 includes/nusoap.orig.php \soapclient::soapclient()

* constructor * *

Parameters

mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object): * @param bool $wsdl optional, set to true if using WSDL * @param int $portName optional portName in WSDL document * @param string $proxyhost * @param string $proxyport * @param string $proxyusername * @param string $proxypassword * @param integer $timeout set the connection timeout * @param integer $response_timeout set the response timeout * @access public

File

includes/nusoap.orig.php, line 6464

Class

soapclient
soapclient higher level class for easy usage.

Code

function soapclient($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30) {
  parent::nusoap_base();
  $this->endpoint = $endpoint;
  $this->proxyhost = $proxyhost;
  $this->proxyport = $proxyport;
  $this->proxyusername = $proxyusername;
  $this->proxypassword = $proxypassword;
  $this->timeout = $timeout;
  $this->response_timeout = $response_timeout;

  // make values
  if ($wsdl) {
    if (is_object($endpoint) && get_class($endpoint) == 'wsdl') {
      $this->wsdl = $endpoint;
      $this->endpoint = $this->wsdl->wsdl;
      $this->wsdlFile = $this->endpoint;
      $this
        ->debug('existing wsdl instance created from ' . $this->endpoint);
    }
    else {
      $this->wsdlFile = $this->endpoint;

      // instantiate wsdl object and parse wsdl file
      $this
        ->debug('instantiating wsdl class with doc: ' . $endpoint);
      $this->wsdl =& new wsdl($this->wsdlFile, $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout);
    }
    $this
      ->appendDebug($this->wsdl
      ->getDebug());
    $this->wsdl
      ->clearDebug();

    // catch errors
    if ($errstr = $this->wsdl
      ->getError()) {
      $this
        ->debug('got wsdl error: ' . $errstr);
      $this
        ->setError('wsdl error: ' . $errstr);
    }
    elseif ($this->operations = $this->wsdl
      ->getOperations()) {
      $this
        ->debug('got ' . count($this->operations) . ' operations from wsdl ' . $this->wsdlFile);
      $this->endpointType = 'wsdl';
    }
    else {
      $this
        ->debug('getOperations returned false');
      $this
        ->setError('no operations defined in the WSDL document!');
    }
  }
  else {
    $this
      ->debug("instantiate SOAP with endpoint at {$endpoint}");
    $this->endpointType = 'soap';
  }
}