You are here

function nusoapclient::_getProxyClassCode in Salesforce Suite 5.2

Same name and namespace in other branches
  1. 5 includes/nusoap.php \nusoapclient::_getProxyClassCode()

* dynamically creates proxy class code * *

Return value

string PHP/NuSOAP code for the proxy class * @access private

2 calls to nusoapclient::_getProxyClassCode()
nusoapclient::getProxy in includes/nusoap.php
* dynamically creates an instance of a proxy class, * allowing user to directly call methods from wsdl * *
nusoapclient::getProxyClassCode in includes/nusoap.php
* dynamically creates proxy class code * *

File

includes/nusoap.php, line 7046

Class

nusoapclient
nusoapclient higher level class for easy usage.

Code

function _getProxyClassCode($r) {
  if ($this->endpointType != 'wsdl') {
    $evalStr = 'A proxy can only be created for a WSDL client';
    $this
      ->setError($evalStr);
    return $evalStr;
  }
  $evalStr = '';
  foreach ($this->operations as $operation => $opData) {
    if ($operation != '') {

      // create param string and param comment string
      if (sizeof($opData['input']['parts']) > 0) {
        $paramStr = '';
        $paramArrayStr = '';
        $paramCommentStr = '';
        foreach ($opData['input']['parts'] as $name => $type) {
          $paramStr .= "\${$name}, ";
          $paramArrayStr .= "'{$name}' => \${$name}, ";
          $paramCommentStr .= "{$type} \${$name}, ";
        }
        $paramStr = substr($paramStr, 0, strlen($paramStr) - 2);
        $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2);
        $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2);
      }
      else {
        $paramStr = '';
        $paramCommentStr = 'void';
      }
      $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
      $evalStr .= "// {$paramCommentStr}\n\tfunction " . str_replace('.', '__', $operation) . "({$paramStr}) {\n\t\t\$params = array({$paramArrayStr});\n\t\treturn \$this->call('{$operation}', \$params, '" . $opData['namespace'] . "', '" . (isset($opData['soapAction']) ? $opData['soapAction'] : '') . "');\n\t}\n\t";
      unset($paramStr);
      unset($paramCommentStr);
    }
  }
  $evalStr = 'class soap_proxy_' . $r . ' extends nusoapclient {
	' . $evalStr . '
}';
  return $evalStr;
}