ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
soap_client Class Reference

soapclient higher level class for easy usage. More...

+ Inheritance diagram for soap_client:
+ Collaboration diagram for soap_client:

Public Member Functions

 soap_client ($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor More...
 
 call ($operation, $params=array(), $namespace='', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
 calls method, returns PHP native type More...
 
 getOperationData ($operation)
 get available data pertaining to an operation More...
 
 send ($msg, $soapaction='', $timeout=0, $response_timeout=30)
 send the SOAP message More...
 
 parseResponse ($headers, $data)
 processes SOAP message returned from server More...
 
 setHeaders ($headers)
 set the SOAP headers More...
 
 getHeaders ()
 get the response headers More...
 
 setHTTPProxy ($proxyhost, $proxyport, $proxyusername='', $proxypassword='')
 set proxy info here More...
 
 setCredentials ($username, $password, $authtype='basic')
 if authenticating, set user credentials here More...
 
 setHTTPEncoding ($enc='gzip, deflate')
 use HTTP encoding More...
 
 useHTTPPersistentConnection ()
 use HTTP persistent connections if possible More...
 
 getDefaultRpcParams ()
 gets the default RPC parameter setting. More...
 
 setDefaultRpcParams ($rpcParams)
 sets the default RPC parameter setting. More...
 
 getProxy ()
 dynamically creates proxy class, allowing user to directly call methods from wsdl More...
 
 getHTTPBody ($soapmsg)
 gets the HTTP body for the current request. More...
 
 getHTTPContentType ()
 gets the HTTP content type for the current request. More...
 
 getHTTPContentTypeCharset ()
 gets the HTTP content type charset for the current request. More...
 
 decodeUTF8 ($bool)
 
- Public Member Functions inherited from nusoap_base
 debug ($string)
 adds debug data to the class level debug string More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 __construct ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 

Data Fields

 $username = ''
 
 $password = ''
 
 $authtype = ''
 
 $requestHeaders = false
 
 $responseHeaders = ''
 
 $document = ''
 
 $endpoint
 
 $error_str = false
 
 $proxyhost = ''
 
 $proxyport = ''
 
 $proxyusername = ''
 
 $proxypassword = ''
 
 $xml_encoding = ''
 
 $http_encoding = false
 
 $timeout = 0
 
 $response_timeout = 30
 
 $endpointType = ''
 
 $persistentConnection = false
 
 $defaultRpcParams = false
 
 $request = ''
 
 $response = ''
 
 $responseData = ''
 
 $decode_utf8 = true
 
 $fault
 
 $faultcode
 
 $faultstring
 
 $faultdetail
 
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 
 $version = '0.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 
 $debug_str = ''
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 

Detailed Description

soapclient higher level class for easy usage.

usage:

// instantiate client with server info $soapclient = new soapclient( string path [ ,boolean wsdl] );

// call method, get results echo $soapclient->call( string methodname [ ,array parameters] );

// bye bye client unset($soapclient);

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com public

Definition at line 4968 of file nusoap.php.

Member Function Documentation

◆ call()

soap_client::call (   $operation,
  $params = array(),
  $namespace = '',
  $soapAction = '',
  $headers = false,
  $rpcParams = null,
  $style = 'rpc',
  $use = 'encoded' 
)

calls method, returns PHP native type

Parameters
string$methodSOAP server URL or path
array$paramsAn array, associative or simple, of the parameters for the method call, or a string that is the XML for the call. For rpc style, this call will wrap the XML in a tag named after the method, as well as the SOAP Envelope and Body. For document style, this will only wrap with the Envelope and Body. IMPORTANT: when using an array with document style, in which case there is really one parameter, the root of the fragment used in the call, which encloses what programmers normally think of parameters. A parameter array must include the wrapper.
string$namespaceoptional method namespace (WSDL can override)
string$soapActionoptional SOAPAction value (WSDL can override)
boolean$headersoptional array of soapval objects for headers
boolean$rpcParamsoptional no longer used
string$styleoptional (rpc|document) the style to use when serializing parameters (WSDL can override)
string$useoptional (encoded|literal) the use when serializing parameters (WSDL can override)
Returns
mixed public

Definition at line 5084 of file nusoap.php.

References $key, $namespace, $params, $style, array, nusoap_base\debug(), nusoap_base\getError(), nusoap_base\getPrefixFromNamespace(), nusoap_base\serialize_val(), nusoap_base\serializeEnvelope(), wsdl\serializeRPCParameters(), and nusoap_base\setError().

5084  {
5085  $this->operation = $operation;
5086  $this->fault = false;
5087  $this->error_str = '';
5088  $this->request = '';
5089  $this->response = '';
5090  $this->responseData = '';
5091  $this->faultstring = '';
5092  $this->faultcode = '';
5093  $this->opData = array();
5094 
5095  $this->debug("call: $operation, $params, $namespace, $soapAction, $headers, $style, $use; endpointType: $this->endpointType");
5096  if ($headers) {
5097  $this->requestHeaders = $headers;
5098  }
5099  // serialize parameters
5100  if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
5101  // use WSDL for operation
5102  $this->opData = $opData;
5103  foreach($opData as $key => $value){
5104  $this->debug("$key -> $value");
5105  }
5106  if (isset($opData['soapAction'])) {
5107  $soapAction = $opData['soapAction'];
5108  }
5109  $this->endpoint = $opData['endpoint'];
5110  $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : ($namespace != '' ? $namespace : 'http://testuri.org');
5111  $style = $opData['style'];
5112  $use = $opData['input']['use'];
5113  // add ns to ns array
5114  if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
5115  $this->wsdl->namespaces['nu'] = $namespace;
5116  }
5117  $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
5118  // serialize payload
5119  if (is_string($params)) {
5120  $this->debug("serializing param string for WSDL operation $operation");
5121  $payload = $params;
5122  } elseif (is_array($params)) {
5123  $this->debug("serializing param array for WSDL operation $operation");
5124  $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params);
5125  } else {
5126  $this->debug('params must be array or string');
5127  $this->setError('params must be array or string');
5128  return false;
5129  }
5130  $usedNamespaces = $this->wsdl->usedNamespaces;
5131  // Partial fix for multiple encoding styles in the same function call
5132  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5133  if (isset($opData['output']['encodingStyle']) && $encodingStyle != $opData['output']['encodingStyle']) {
5134  $methodEncodingStyle = ' SOAP-ENV:encodingStyle="' . $opData['output']['encodingStyle'] . '"';
5135  } else {
5136  $methodEncodingStyle = '';
5137  }
5138  $this->debug("wsdl debug: \n".$this->wsdl->debug_str);
5139  $this->wsdl->debug_str = '';
5140  if ($errstr = $this->wsdl->getError()) {
5141  $this->debug('got wsdl error: '.$errstr);
5142  $this->setError('wsdl error: '.$errstr);
5143  return false;
5144  }
5145  } elseif($this->endpointType == 'wsdl') {
5146  // operation not in WSDL
5147  $this->setError( 'operation '.$operation.' not present.');
5148  $this->debug("operation '$operation' not present.");
5149  $this->debug("wsdl debug: \n".$this->wsdl->debug_str);
5150  $this->wsdl->debug_str = '';
5151  return false;
5152  } else {
5153  // no WSDL
5154  if($namespace == ''){
5155  $namespace = 'http://testuri.org';
5156  }
5157  //$this->namespaces['ns1'] = $namespace;
5158  $nsPrefix = 'ns1';
5159  // serialize
5160  $payload = '';
5161  if (is_string($params)) {
5162  $this->debug("serializing param string for operation $operation");
5163  $payload = $params;
5164  } elseif (is_array($params)) {
5165  $this->debug("serializing param array for operation $operation");
5166  foreach($params as $k => $v){
5167  $payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
5168  }
5169  } else {
5170  $this->debug('params must be array or string');
5171  $this->setError('params must be array or string');
5172  return false;
5173  }
5174  $usedNamespaces = array();
5175  $methodEncodingStyle = '';
5176  }
5177  // wrap RPC calls with method element
5178  if ($style == 'rpc') {
5179  if ($use == 'literal') {
5180  $this->debug("wrapping RPC request with literal method element");
5181  $payload = "<$operation xmlns=\"$namespace\">" . $payload . "</$operation>";
5182  } else {
5183  $this->debug("wrapping RPC request with encoded method element");
5184  $payload = "<$nsPrefix:$operation$methodEncodingStyle xmlns:$nsPrefix=\"$namespace\">" .
5185  $payload .
5186  "</$nsPrefix:$operation>";
5187  }
5188  }
5189  // serialize envelope
5190  $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use);
5191 //echo htmlentities($soapmsg)."<br><br>";
5192  $this->debug("endpoint: $this->endpoint, soapAction: $soapAction, namespace: $namespace, style: $style, use: $use");
5193  $this->debug('SOAP message length: ' . strlen($soapmsg) . ' contents: ' . substr($soapmsg, 0, 1000));
5194  // send
5195  $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
5196  if($errstr = $this->getError()){
5197  $this->debug('Error: '.$errstr);
5198  return false;
5199  } else {
5200  $this->return = $return;
5201  $this->debug('sent message successfully and got a(n) '.gettype($return).' back');
5202 
5203  // fault?
5204  if(is_array($return) && isset($return['faultcode'])){
5205  $this->debug('got fault');
5206  $this->setError($return['faultcode'].': '.$return['faultstring']);
5207  $this->fault = true;
5208  foreach($return as $k => $v){
5209  $this->$k = $v;
5210  $this->debug("$k = $v<br>");
5211  }
5212  return $return;
5213  } else {
5214  // array of return values
5215  if(is_array($return)){
5216  // multiple 'out' parameters
5217  if(sizeof($return) > 1){
5218  return $return;
5219  }
5220  // single 'out' parameter
5221  return array_shift($return);
5222  // nothing returned (ie, echoVoid)
5223  } else {
5224  return "";
5225  }
5226  }
5227  }
5228  }
$params
Definition: disable.php:11
if($err=$client->getError()) $namespace
serializeEnvelope($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
serialize message
Definition: nusoap.php:417
setError($str)
sets error string
Definition: nusoap.php:184
$style
Definition: example_012.php:70
getOperationData($operation)
get available data pertaining to an operation
Definition: nusoap.php:5237
parses a WSDL file, allows access to it&#39;s data, other utility methods
Definition: nusoap.php:3133
getHTTPBody($soapmsg)
gets the HTTP body for the current request.
Definition: nusoap.php:5542
getError()
returns error string if present
Definition: nusoap.php:171
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:557
send($msg, $soapaction='', $timeout=0, $response_timeout=30)
send the SOAP message
Definition: nusoap.php:5258
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:212
Create styles array
The data for the language used.
serializeRPCParameters($operation, $direction, $parameters)
serialize a PHP value according to a WSDL message definition
Definition: nusoap.php:3870
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ decodeUTF8()

soap_client::decodeUTF8 (   $bool)

Definition at line 5577 of file nusoap.php.

5577  {
5578  $this->decode_utf8 = $bool;
5579  return true;
5580  }

◆ getDefaultRpcParams()

soap_client::getDefaultRpcParams ( )

gets the default RPC parameter setting.

If true, default is that call params are like RPC even for document style. Each call() can override this value.

This is no longer used.

public

Deprecated:

Definition at line 5463 of file nusoap.php.

5463  {
5464  return $this->defaultRpcParams;
5465  }

◆ getHeaders()

soap_client::getHeaders ( )

get the response headers

Returns
mixed object SOAPx4 soapval object or empty if no headers public

Definition at line 5398 of file nusoap.php.

5398  {
5399  if($this->responseHeaders != '') {
5400  return $this->responseHeaders;
5401  }
5402  }

◆ getHTTPBody()

soap_client::getHTTPBody (   $soapmsg)

gets the HTTP body for the current request.

Parameters
string$soapmsgThe SOAP payload
Returns
string The HTTP body, which includes the SOAP payload protected

Definition at line 5542 of file nusoap.php.

5542  {
5543  return $soapmsg;
5544  }

◆ getHTTPContentType()

soap_client::getHTTPContentType ( )

gets the HTTP content type for the current request.

Note: getHTTPBody must be called before this.

Returns
string the HTTP content type for the current request. protected

Definition at line 5554 of file nusoap.php.

5554  {
5555  return 'text/xml';
5556  }

◆ getHTTPContentTypeCharset()

soap_client::getHTTPContentTypeCharset ( )

gets the HTTP content type charset for the current request.

returns false for non-text content types.

Note: getHTTPBody must be called before this.

Returns
string the HTTP content type charset for the current request. protected

Definition at line 5567 of file nusoap.php.

References nusoap_base\$soap_defencoding.

5567  {
5568  return $this->soap_defencoding;
5569  }
$soap_defencoding
Definition: nusoap.php:86

◆ getOperationData()

soap_client::getOperationData (   $operation)

get available data pertaining to an operation

Parameters
string$operationoperation name
Returns
array array of data pertaining to the operation public

Definition at line 5237 of file nusoap.php.

References nusoap_base\debug().

5237  {
5238  if(isset($this->operations[$operation])){
5239  return $this->operations[$operation];
5240  }
5241  $this->debug("No data for operation: $operation");
5242  }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ Here is the call graph for this function:

◆ getProxy()

soap_client::getProxy ( )

dynamically creates proxy class, allowing user to directly call methods from wsdl

Returns
object soap_proxy object public

Definition at line 5485 of file nusoap.php.

References $name, $password, $r, and $type.

5485  {
5486  $evalStr = '';
5487  foreach($this->operations as $operation => $opData){
5488  if($operation != ''){
5489  // create param string
5490  $paramStr = '';
5491  if(sizeof($opData['input']['parts']) > 0){
5492  foreach($opData['input']['parts'] as $name => $type){
5493  $paramStr .= "\$$name,";
5494  }
5495  $paramStr = substr($paramStr,0,strlen($paramStr)-1);
5496  }
5497  $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
5498  $evalStr .= "function $operation ($paramStr){
5499  // load params into array
5500  \$params = array($paramStr);
5501  return \$this->call('$operation',\$params,'".$opData['namespace']."','".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
5502  }";
5503  unset($paramStr);
5504  }
5505  }
5506  $r = rand();
5507  $evalStr = 'class soap_proxy_'.$r.' extends soap_client {
5508  '.$evalStr.'
5509  }';
5510  //print "proxy class:<pre>$evalStr</pre>";
5511  // eval the class
5512  eval($evalStr);
5513  // instantiate proxy object
5514  eval("\$proxy = new soap_proxy_$r('');");
5515  // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
5516  $proxy->endpointType = 'wsdl';
5517  $proxy->wsdlFile = $this->wsdlFile;
5518  $proxy->wsdl = $this->wsdl;
5519  $proxy->operations = $this->operations;
5520  $proxy->defaultRpcParams = $this->defaultRpcParams;
5521  // transfer other state
5522  $proxy->username = $this->username;
5523  $proxy->password = $this->password;
5524  $proxy->proxyhost = $this->proxyhost;
5525  $proxy->proxyport = $this->proxyport;
5526  $proxy->proxyusername = $this->proxyusername;
5527  $proxy->proxypassword = $this->proxypassword;
5528  $proxy->timeout = $this->timeout;
5529  $proxy->response_timeout = $this->response_timeout;
5530  $proxy->http_encoding = $this->http_encoding;
5531  $proxy->persistentConnection = $this->persistentConnection;
5532  return $proxy;
5533  }
$type
if($format !==null) $name
Definition: metadata.php:146
$r
Definition: example_031.php:79
$persistentConnection
Definition: nusoap.php:4987

◆ parseResponse()

soap_client::parseResponse (   $headers,
  $data 
)

processes SOAP message returned from server

Parameters
array$headersThe HTTP headers
string$dataunprocessed response data from server
Returns
mixed value of the message, decoded into a PHP type protected

Definition at line 5339 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

5339  {
5340  $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
5341  if (!strstr($headers['content-type'], 'text/xml')) {
5342 echo "-".$data."<br /><br />".htmlentities($data)."-";
5343  $this->setError('Response not of type text/xml');
5344  return false;
5345  }
5346  if (strpos($headers['content-type'], '=')) {
5347  $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
5348  $this->debug('Got response encoding: ' . $enc);
5349  if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
5350  $this->xml_encoding = strtoupper($enc);
5351  } else {
5352  $this->xml_encoding = 'US-ASCII';
5353  }
5354  } else {
5355  // should be US-ASCII, but for XML, let's be pragmatic and admit UTF-8 is most common
5356  $this->xml_encoding = 'UTF-8';
5357  }
5358  $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
5359  $parser = new soap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
5360  // add parser debug data to our debug
5361  $this->debug($parser->debug_str);
5362  // if parse errors
5363  if($errstr = $parser->getError()){
5364  $this->setError( $errstr);
5365  // destroy the parser object
5366  unset($parser);
5367  return false;
5368  } else {
5369  // get SOAP headers
5370  $this->responseHeaders = $parser->getHeaders();
5371  // get decoded message
5372  $return = $parser->get_response();
5373  // add document for doclit support
5374  $this->document = $parser->document;
5375  // destroy the parser object
5376  unset($parser);
5377  // return decode message
5378  return $return;
5379  }
5380  }
setError($str)
sets error string
Definition: nusoap.php:184
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
soap_parser class parses SOAP XML messages into native PHP values
Definition: nusoap.php:4431
$parser
Definition: BPMN2Parser.php:23
+ Here is the call graph for this function:

◆ send()

soap_client::send (   $msg,
  $soapaction = '',
  $timeout = 0,
  $response_timeout = 30 
)

send the SOAP message

Note: if the operation has multiple return values the return value of this method will be an array of those values.

@param    string $msg a SOAPx4 soapmsg object
@param    string $soapaction SOAPAction value
@param    integer $timeout set connection timeout in seconds
@param      integer $response_timeout set response timeout in seconds
@return     mixed native PHP types.
@access   private

Definition at line 5258 of file nusoap.php.

References $http, nusoap_base\debug(), nusoap_base\getError(), and nusoap_base\setError().

5258  {
5259  // detect transport
5260  switch(true){
5261  // http(s)
5262  case ereg('^http',$this->endpoint):
5263  $this->debug('transporting via HTTP');
5264  if($this->persistentConnection == true && is_object($this->persistentConnection)){
5266  } else {
5267  $http = new soap_transport_http($this->endpoint);
5268  if ($this->persistentConnection) {
5269  $http->usePersistentConnection();
5270  }
5271  }
5272  $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
5273  $http->setSOAPAction($soapaction);
5274  if($this->proxyhost && $this->proxyport){
5275  $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
5276  }
5277  if($this->username != '' && $this->password != '') {
5278  $http->setCredentials($this->username, $this->password, $this->authtype);
5279  }
5280  if($this->http_encoding != ''){
5281  $http->setEncoding($this->http_encoding);
5282  }
5283  $this->debug('sending message, length: '.strlen($msg));
5284  if(ereg('^http:',$this->endpoint)){
5285  //if(strpos($this->endpoint,'http:')){
5286  $this->responseData = $http->send($msg,$timeout,$response_timeout);
5287  } elseif(ereg('^https',$this->endpoint)){
5288  //} elseif(strpos($this->endpoint,'https:')){
5289  //if(phpversion() == '4.3.0-dev'){
5290  //$response = $http->send($msg,$timeout,$response_timeout);
5291  //$this->request = $http->outgoing_payload;
5292  //$this->response = $http->incoming_payload;
5293  //} else
5294  if (extension_loaded('curl')) {
5295  $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout);
5296  } else {
5297  $this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
5298  }
5299  } else {
5300  $this->setError('no http/s in endpoint url');
5301  }
5302  $this->request = $http->outgoing_payload;
5303  $this->response = $http->incoming_payload;
5304  $this->debug("transport debug data...\n".$http->debug_str);
5305 
5306  // save transport object if using persistent connections
5307  if ($this->persistentConnection) {
5308  $http->debug_str = '';
5309  if (!is_object($this->persistentConnection)) {
5310  $this->persistentConnection = $http;
5311  }
5312  }
5313 
5314  if($err = $http->getError()){
5315  $this->setError('HTTP Error: '.$err);
5316  return false;
5317  } elseif($this->getError()){
5318  return false;
5319  } else {
5320  $this->debug('got response, length: '. strlen($this->responseData).' type: '.$http->incoming_headers['content-type']);
5321  return $this->parseResponse($http->incoming_headers, $this->responseData);
5322  }
5323  break;
5324  default:
5325  $this->setError('no transport found, or selected transport is not yet supported!');
5326  return false;
5327  break;
5328  }
5329  }
setError($str)
sets error string
Definition: nusoap.php:184
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CUR...
Definition: nusoap.php:1552
getError()
returns error string if present
Definition: nusoap.php:171
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
parseResponse($headers, $data)
processes SOAP message returned from server
Definition: nusoap.php:5339
getHTTPContentType()
gets the HTTP content type for the current request.
Definition: nusoap.php:5554
$http
Definition: raiseError.php:7
getHTTPContentTypeCharset()
gets the HTTP content type charset for the current request.
Definition: nusoap.php:5567
$persistentConnection
Definition: nusoap.php:4987
+ Here is the call graph for this function:

◆ setCredentials()

soap_client::setCredentials (   $username,
  $password,
  $authtype = 'basic' 
)

if authenticating, set user credentials here

Parameters
string$username
string$password
string$authtype(basic|digest) public

Definition at line 5428 of file nusoap.php.

References $password.

5428  {
5429  $this->username = $username;
5430  $this->password = $password;
5431  $this->authtype = $authtype;
5432  }

◆ setDefaultRpcParams()

soap_client::setDefaultRpcParams (   $rpcParams)

sets the default RPC parameter setting.

If true, default is that call params are like RPC even for document style Each call() can override this value.

Parameters
boolean$rpcParamspublic

Definition at line 5475 of file nusoap.php.

5475  {
5476  $this->defaultRpcParams = $rpcParams;
5477  }

◆ setHeaders()

soap_client::setHeaders (   $headers)

set the SOAP headers

Parameters
$headersstring XML public

Definition at line 5388 of file nusoap.php.

5388  {
5389  $this->requestHeaders = $headers;
5390  }

◆ setHTTPEncoding()

soap_client::setHTTPEncoding (   $enc = 'gzip,
deflate'   
)

use HTTP encoding

Parameters
string$encpublic

Definition at line 5440 of file nusoap.php.

5440  {
5441  $this->http_encoding = $enc;
5442  }

◆ setHTTPProxy()

soap_client::setHTTPProxy (   $proxyhost,
  $proxyport,
  $proxyusername = '',
  $proxypassword = '' 
)

set proxy info here

Parameters
string$proxyhost
string$proxyport
string$proxyusername
string$proxypasswordpublic

Definition at line 5413 of file nusoap.php.

5413  {
5414  $this->proxyhost = $proxyhost;
5415  $this->proxyport = $proxyport;
5416  $this->proxyusername = $proxyusername;
5417  $this->proxypassword = $proxypassword;
5418  }

◆ soap_client()

soap_client::soap_client (   $endpoint,
  $wsdl = false,
  $proxyhost = false,
  $proxyport = false,
  $proxyusername = false,
  $proxypassword = false,
  $timeout = 0,
  $response_timeout = 30 
)

constructor

Parameters
mixed$endpointSOAP server or WSDL URL (string), or wsdl instance (object)
bool$wsdloptional, set to true if using WSDL
int$portNameoptional portName in WSDL document
string$proxyhost
string$proxyport
string$proxyusername
string$proxypassword
integer$timeoutset the connection timeout
integer$response_timeoutset the response timeout public

Definition at line 5020 of file nusoap.php.

References $endpoint, nusoap_base\debug(), nusoap_base\getError(), wsdl\getOperations(), nusoap_base\setError(), and wsdl\wsdl().

5020  {
5021  $this->endpoint = $endpoint;
5022  $this->proxyhost = $proxyhost;
5023  $this->proxyport = $proxyport;
5024  $this->proxyusername = $proxyusername;
5025  $this->proxypassword = $proxypassword;
5026  $this->timeout = $timeout;
5027  $this->response_timeout = $response_timeout;
5028 
5029  // make values
5030  if($wsdl){
5031  $this->endpointType = 'wsdl';
5032  if (is_object($endpoint) && is_a($endpoint, 'wsdl')) {
5033  $this->wsdl = $endpoint;
5034  $this->endpoint = $this->wsdl->wsdl;
5035  $this->wsdlFile = $this->endpoint;
5036  $this->debug('existing wsdl instance created from ' . $this->endpoint);
5037  } else {
5038  $this->wsdlFile = $this->endpoint;
5039 
5040  // instantiate wsdl object and parse wsdl file
5041  $this->debug('instantiating wsdl class with doc: '.$endpoint);
5042  $this->wsdl =& new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout);
5043  }
5044  $this->debug("wsdl debug...\n".$this->wsdl->debug_str);
5045  $this->wsdl->debug_str = '';
5046  // catch errors
5047  if($errstr = $this->wsdl->getError()){
5048  $this->debug('got wsdl error: '.$errstr);
5049  $this->setError('wsdl error: '.$errstr);
5050  } elseif($this->operations = $this->wsdl->getOperations()){
5051  $this->debug( 'got '.count($this->operations).' operations from wsdl '.$this->wsdlFile);
5052  } else {
5053  $this->debug( 'getOperations returned false');
5054  $this->setError('no operations defined in the WSDL document!');
5055  }
5056  }
5057  }
setError($str)
sets error string
Definition: nusoap.php:184
parses a WSDL file, allows access to it&#39;s data, other utility methods
Definition: nusoap.php:3133
getError()
returns error string if present
Definition: nusoap.php:171
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
wsdl($wsdl='', $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
constructor
Definition: nusoap.php:3181
getOperations($bindingType='soap')
returns an assoc array of operation names => operation data
Definition: nusoap.php:3649
+ Here is the call graph for this function:

◆ useHTTPPersistentConnection()

soap_client::useHTTPPersistentConnection ( )

use HTTP persistent connections if possible

public

Definition at line 5449 of file nusoap.php.

5449  {
5450  $this->persistentConnection = true;
5451  }

Field Documentation

◆ $authtype

soap_client::$authtype = ''

Definition at line 4972 of file nusoap.php.

◆ $decode_utf8

soap_client::$decode_utf8 = true

Definition at line 4993 of file nusoap.php.

◆ $defaultRpcParams

soap_client::$defaultRpcParams = false

Definition at line 4988 of file nusoap.php.

◆ $document

soap_client::$document = ''

Definition at line 4975 of file nusoap.php.

◆ $endpoint

soap_client::$endpoint

Definition at line 4976 of file nusoap.php.

◆ $endpointType

soap_client::$endpointType = ''

Definition at line 4986 of file nusoap.php.

◆ $error_str

soap_client::$error_str = false

Definition at line 4977 of file nusoap.php.

◆ $fault

soap_client::$fault

Definition at line 5004 of file nusoap.php.

◆ $faultcode

soap_client::$faultcode

Definition at line 5004 of file nusoap.php.

◆ $faultdetail

soap_client::$faultdetail

Definition at line 5004 of file nusoap.php.

◆ $faultstring

soap_client::$faultstring

Definition at line 5004 of file nusoap.php.

◆ $http_encoding

soap_client::$http_encoding = false

Definition at line 4983 of file nusoap.php.

◆ $password

soap_client::$password = ''

Definition at line 4971 of file nusoap.php.

◆ $persistentConnection

soap_client::$persistentConnection = false

Definition at line 4987 of file nusoap.php.

◆ $proxyhost

soap_client::$proxyhost = ''

Definition at line 4978 of file nusoap.php.

◆ $proxypassword

soap_client::$proxypassword = ''

Definition at line 4981 of file nusoap.php.

◆ $proxyport

soap_client::$proxyport = ''

Definition at line 4979 of file nusoap.php.

◆ $proxyusername

soap_client::$proxyusername = ''

Definition at line 4980 of file nusoap.php.

◆ $request

soap_client::$request = ''

Definition at line 4989 of file nusoap.php.

◆ $requestHeaders

soap_client::$requestHeaders = false

Definition at line 4973 of file nusoap.php.

◆ $response

soap_client::$response = ''

Definition at line 4990 of file nusoap.php.

◆ $response_timeout

soap_client::$response_timeout = 30

Definition at line 4985 of file nusoap.php.

◆ $responseData

soap_client::$responseData = ''

Definition at line 4991 of file nusoap.php.

◆ $responseHeaders

soap_client::$responseHeaders = ''

Definition at line 4974 of file nusoap.php.

◆ $timeout

soap_client::$timeout = 0

Definition at line 4984 of file nusoap.php.

◆ $username

soap_client::$username = ''

Definition at line 4970 of file nusoap.php.

◆ $xml_encoding

soap_client::$xml_encoding = ''

Definition at line 4982 of file nusoap.php.


The documentation for this class was generated from the following file: