diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..da1fc41f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 2.6.0 - TBD + +### Added + +- [#1](https://github.com/zendframework/zend-soap/pull/1) adds + support for the `SoapClient` options `keep_alive` and `ssl_method`. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/src/Client.php b/src/Client.php index 850fcc96..ecf098c1 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,6 +83,20 @@ class Client implements ServerClient */ protected $wsdl = null; + /** + * Whether to send the "Connection: Keep-Alive" header (true) or "Connection: close" header (false) + * Available since PHP 5.4.0 + * @var bool + */ + protected $keepAlive; + + /** + * One of SOAP_SSL_METHOD_TLS, SOAP_SSL_METHOD_SSLv2, SOAP_SSL_METHOD_SSLv3 or SOAP_SSL_METHOD_SSLv23 + * Available since PHP 5.5.0 + * @var int + */ + protected $sslMethod; + /**#@+ * @var string */ @@ -275,6 +289,16 @@ public function setOptions($options) $this->connectionTimeout = $value; break; + case 'keepalive': + case 'keep_alive': + $this->setKeepAlive($value); + break; + + case 'sslmethod': + case 'ssl_method': + $this->setSslMethod($value); + break; + default: throw new Exception\InvalidArgumentException('Unknown SOAP client option'); } @@ -315,6 +339,8 @@ public function getOptions() $options['cache_wsdl'] = $this->getWSDLCache(); $options['features'] = $this->getSoapFeatures(); $options['user_agent'] = $this->getUserAgent(); + $options['keep_alive'] = $this->getKeepAlive(); + $options['ssl_method'] = $this->getSslMethod(); foreach ($options as $key => $value) { /* @@ -1210,4 +1236,40 @@ public function setCookie($cookieName, $cookieValue=null) $soapClient->__setCookie($cookieName, $cookieValue); return $this; } + + /** + * @return boolean + */ + public function getKeepAlive() + { + return $this->keepAlive; + } + + /** + * @param boolean $keepAlive + * @return self + */ + public function setKeepAlive($keepAlive) + { + $this->keepAlive = (bool) $keepAlive; + return $this; + } + + /** + * @return int + */ + public function getSslMethod() + { + return $this->sslMethod; + } + + /** + * @param int $sslMethod + * @return self + */ + public function setSslMethod($sslMethod) + { + $this->sslMethod = $sslMethod; + return $this; + } } diff --git a/test/ClientTest.php b/test/ClientTest.php index 51a734d9..2cfa115b 100644 --- a/test/ClientTest.php +++ b/test/ClientTest.php @@ -79,7 +79,9 @@ public function testSetOptions() 'features' => 4, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5, - 'typemap' => $typeMap + 'typemap' => $typeMap, + 'keep_alive' => true, + 'ssl_method' => 3, ]; $client->setOptions($nonWSDLOptions); @@ -112,7 +114,9 @@ public function testSetOptions() 'stream_context' => $ctx, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5, - 'typemap' => $typeMap + 'typemap' => $typeMap, + 'keep_alive' => true, + 'ssl_method' => 3, ]; $client1->setOptions($wsdlOptions); @@ -163,7 +167,9 @@ public function testGetOptions() 'passphrase' => 'some pass phrase', 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5, - 'typemap' => $typeMap + 'typemap' => $typeMap, + 'keep_alive' => true, + 'ssl_method' => 3, ]; $client->setOptions($options);