function nusoapclient::send in Salesforce Suite 5
Same name and namespace in other branches
- 5.2 includes/nusoap.php \nusoapclient::send()
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.
*
Parameters
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
1 call to nusoapclient::send()
- nusoapclient::call in includes/
nusoap.php - * calls method, returns PHP native type * *
File
- includes/
nusoap.php, line 6768
Class
- nusoapclient
- nusoapclient higher level class for easy usage.
Code
function send($msg, $soapaction = '', $timeout = 0, $response_timeout = 30) {
$this
->checkCookies();
// detect transport
switch (true) {
// http(s)
case ereg('^http', $this->endpoint):
$this
->debug('transporting via HTTP');
if ($this->persistentConnection == true && is_object($this->persistentConnection)) {
$http =& $this->persistentConnection;
}
else {
$http = new soap_transport_http($this->endpoint);
if ($this->persistentConnection) {
$http
->usePersistentConnection();
}
}
$http
->setContentType($this
->getHTTPContentType(), $this
->getHTTPContentTypeCharset());
$http
->setSOAPAction($soapaction);
if ($this->proxyhost && $this->proxyport) {
$http
->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
}
if ($this->authtype != '') {
$http
->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
}
if ($this->http_encoding != '') {
$http
->setEncoding($this->http_encoding);
}
$this
->debug('sending message, length=' . strlen($msg));
if (ereg('^http:', $this->endpoint)) {
//if(strpos($this->endpoint,'http:')){
$this->responseData = $http
->send($msg, $timeout, $response_timeout, $this->cookies);
}
elseif (ereg('^https', $this->endpoint)) {
//} elseif(strpos($this->endpoint,'https:')){
//if(phpversion() == '4.3.0-dev'){
//$response = $http->send($msg,$timeout,$response_timeout);
//$this->request = $http->outgoing_payload;
//$this->response = $http->incoming_payload;
//} else
$this->responseData = $http
->sendHTTPS($msg, $timeout, $response_timeout, $this->cookies);
}
else {
$this
->setError('no http/s in endpoint url');
}
$this->request = $http->outgoing_payload;
$this->response = $http->incoming_payload;
$this
->appendDebug($http
->getDebug());
$this
->UpdateCookies($http->incoming_cookies);
// save transport object if using persistent connections
if ($this->persistentConnection) {
$http
->clearDebug();
if (!is_object($this->persistentConnection)) {
$this->persistentConnection = $http;
}
}
if ($err = $http
->getError()) {
$this
->setError('HTTP Error: ' . $err);
return false;
}
elseif ($this
->getError()) {
return false;
}
else {
$this
->debug('got response, length=' . strlen($this->responseData) . ' type=' . $http->incoming_headers['content-type']);
return $this
->parseResponse($http->incoming_headers, $this->responseData);
}
break;
default:
$this
->setError('no transport found, or selected transport is not yet supported!');
return false;
break;
}
}