Exemple #1
0
 /**
  * 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 timeout in seconds
  * @return	mixed native PHP types.
  * @access   private
  */
 function send($msg, $soapaction = '', $timeout = 0)
 {
     // detect transport
     switch (true) {
         // http(s)
         case ereg('^http', $this->endpoint):
             $this->debug('transporting via HTTP');
             if ($this->persistentConnection && is_object($this->persistentConnection)) {
                 $http =& $this->persistentConnection;
             } else {
                 $http = new soap_transport_http($this->endpoint);
                 // pass encoding into transport layer, so appropriate http headers are sent
                 $http->soap_defencoding = $this->soap_defencoding;
             }
             $http->setSOAPAction($soapaction);
             if ($this->proxyhost && $this->proxyport) {
                 $http->setProxy($this->proxyhost, $this->proxyport);
             }
             if ($this->username != '' && $this->password != '') {
                 $http->setCredentials($this->username, $this->password);
             }
             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:')){
                 $response = $http->send($msg, $timeout);
             } elseif (ereg('^https', $this->endpoint)) {
                 //} elseif(strpos($this->endpoint,'https:')){
                 //if(phpversion() == '4.3.0-dev'){
                 //$response = $http->send($msg,$timeout);
                 //$this->request = $http->outgoing_payload;
                 //$this->response = $http->incoming_payload;
                 //} else
                 if (extension_loaded('curl')) {
                     $response = $http->sendHTTPS($msg, $timeout);
                 } else {
                     $this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
                 }
             } else {
                 $this->setError('no http/s in endpoint url');
             }
             $this->request = $http->outgoing_payload;
             $this->response = $http->incoming_payload;
             $this->debug("transport debug data...\n" . $http->debug_str);
             // save transport object if using persistent connections
             if ($this->persistentConnection && !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($response));
                 return $this->parseResponse($response);
             }
             break;
         default:
             $this->setError('no transport found, or selected transport is not yet supported!');
             return false;
             break;
     }
 }
Exemple #2
0
 /**
  * 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
  */
 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;
     }
 }
Exemple #3
0
 /**
  * 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
  */
 function send($msg, $soapaction = '', $timeout = 0, $response_timeout = 30)
 {
     // detect transport
     switch (true) {
         // http(s)
         case preg_match('/^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->username != '' && $this->password != '') {
                 $http->setCredentials($this->username, $this->password);
             }
             if ($this->http_encoding != '') {
                 $http->setEncoding($this->http_encoding);
             }
             $this->debug('sending message, length: ' . strlen($msg));
             if (preg_match('#^http:#', $this->endpoint)) {
                 //if(strpos($this->endpoint,'http:')){
                 $this->responseData = $http->send($msg, $timeout, $response_timeout);
             } elseif (preg_match('#^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
                 if (extension_loaded('curl')) {
                     $this->responseData = $http->sendHTTPS($msg, $timeout, $response_timeout);
                 } else {
                     $this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
                 }
             } else {
                 $this->setError('no http/s in endpoint url');
             }
             $this->request = $http->outgoing_payload;
             $this->response = $http->incoming_payload;
             $this->debug("transport debug data...\n" . $http->debug_str);
             // save transport object if using persistent connections
             if ($this->persistentConnection) {
                 $http->debug_str = '';
                 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;
     }
 }
 /**
  * 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 timeout in seconds
  * @return	mixed native PHP types.
  * @access   private
  */
 function send($msg, $soapaction = '', $timeout = 0)
 {
     // detect transport
     switch (true) {
         // http(s)
         case preg_match('/^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);
                 // pass encoding into transport layer, so appropriate http headers are sent
                 $http->soap_defencoding = $this->soap_defencoding;
                 if ($this->persistentConnection) {
                     $http->usePersistentConnection();
                 }
             }
             $http->setSOAPAction($soapaction);
             if ($this->proxyhost && $this->proxyport) {
                 $http->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
             }
             if ($this->username != '' && $this->password != '') {
                 $http->setCredentials($this->username, $this->password);
             }
             if ($this->http_encoding != '') {
                 $http->setEncoding($this->http_encoding);
             }
             $this->debug('sending message, length: ' . strlen($msg));
             if (preg_match('/^http:/', $this->endpoint)) {
                 //if(strpos($this->endpoint,'http:')){
                 $this->responseData = $http->send($msg, $timeout);
             } elseif (preg_match('/^https/', $this->endpoint)) {
                 //} elseif(strpos($this->endpoint,'https:')){
                 //if(phpversion() == '4.3.0-dev'){
                 //$response = $http->send($msg,$timeout);
                 //$this->request = $http->outgoing_payload;
                 //$this->response = $http->incoming_payload;
                 //} else
                 if (extension_loaded('curl')) {
                     $this->responseData = $http->sendHTTPS($msg, $timeout);
                 } else {
                     $this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
                 }
             } else {
                 $this->setError('no http/s in endpoint url');
             }
             $this->request = $http->outgoing_payload;
             $this->response = $http->incoming_payload;
             $this->debug("transport debug data...\n" . $http->debug_str);
             // save transport object if using persistent connections
             if ($this->persistentConnection && !is_object($this->persistentConnection)) {
                 $this->persistentConnection = $http;
             }
             if ($err = $http->getError()) {
                 $this->setError('HTTP Error: ' . $err);
                 return false;
             } elseif ($this->getError()) {
                 return false;
             } else {
                 if (strpos($http->incoming_headers['content-type'], '=')) {
                     $enc = str_replace('"', '', substr(strstr($http->incoming_headers["content-type"], '='), 1));
                     $this->debug('got response encoding: ' . $enc);
                     if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
                         $this->xml_encoding = strtoupper($enc);
                     } else {
                         $this->xml_encoding = 'US-ASCII';
                     }
                 } else {
                     // should be US-ASCII, but for XML, let's be pragmatic and admit UTF-8 is most common
                     $this->xml_encoding = 'UTF-8';
                 }
                 $this->debug('got response, length: ' . strlen($this->responseData) . ' use encoding: ' . $this->xml_encoding);
                 return $this->parseResponse($this->responseData);
             }
             break;
         default:
             $this->setError('no transport found, or selected transport is not yet supported!');
             return false;
             break;
     }
 }
Exemple #5
0
 /**
  * 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 timeout in seconds
  * @return	mixed native PHP types.
  * @access   private
  */
 function send($msg, $soapaction = '', $timeout = 0)
 {
     // detect transport
     switch (true) {
         // http(s)
         case ereg('^http', $this->endpoint):
             $this->debug('transporting via HTTP');
             $http = new soap_transport_http($this->endpoint);
             $http->setSOAPAction($soapaction);
             if ($this->proxyhost && $this->proxyport) {
                 $http->setProxy($this->proxyhost, $this->proxyport);
             }
             if ($this->username != '' && $this->password != '') {
                 $http->setCredentials($this->username, $this->password);
             }
             if ($this->http_encoding != '') {
                 $http->setEncoding($this->http_encoding);
             }
             $this->debug('sending message, length: ' . strlen($msg));
             if (ereg('^http:', $this->endpoint)) {
                 $response = $http->send($msg, $timeout);
                 $this->request = $http->outgoing_payload;
                 $this->response = $http->incoming_payload;
             } elseif (ereg('^https', $this->endpoint)) {
                 if (!extension_loaded('curl')) {
                     $this->setError('CURL Extension is required for HTTPS');
                     return false;
                 }
                 $response = $http->sendHTTPS($msg, $timeout);
                 $this->request = $http->outgoing_payload;
                 $this->response = $http->incoming_payload;
             }
             $this->debug("transport debug data...\n" . $http->debug_str);
             if ($err = $http->getError()) {
                 $this->setError('HTTP Error: ' . $err);
                 return false;
             }
             $this->debug('got response, length: ' . strlen($response));
             return $this->parseResponse($response);
             break;
         default:
             $this->setError('no transport found, or selected transport is not yet supported!');
             return false;
             break;
     }
 }