Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merging develop to master in preparation for 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Apr 21, 2016
2 parents da96542 + a69e69f commit 96a684b
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 3 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

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`.
- [#20](https://github.com/zendframework/zend-soap/pull/20) adds support for
the `SoapServer` `send_errors` constructor option.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 2.5.2 - 2016-04-21

### Added
Expand Down
62 changes: 62 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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) {
/*
Expand Down Expand Up @@ -1234,4 +1260,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;
}
}
36 changes: 36 additions & 0 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ class Server implements ZendServerServer
*/
protected $wsdlCache;

/**
* The send_errors Options of SOAP Server
* @var bool
*/
protected $sendErrors;

/**
* Constructor
*
Expand Down Expand Up @@ -229,6 +235,10 @@ public function setOptions($options)
$this->setSoapFeatures($value);
break;

case 'send_errors':
$this->setSendErrors($value);
break;

default:
break;
}
Expand Down Expand Up @@ -277,6 +287,10 @@ public function getOptions()
$options['cache_wsdl'] = $this->getWSDLCache();
}

if (null !== $this->sendErrors) {
$options['send_errors'] = $this->getSendErrors();
}

return $options;
}

Expand Down Expand Up @@ -536,6 +550,28 @@ public function getWSDLCache()
return $this->wsdlCache;
}

/**
* Set the SOAP send_errors Option
*
* @param bool $sendErrors
* @return self
*/
public function setSendErrors($sendErrors)
{
$this->sendErrors = (bool) $sendErrors;
return $this;
}

/**
* Get current SOAP send_errors option
*
* @return bool
*/
public function getSendErrors()
{
return $this->sendErrors;
}

/**
* Attach a function as a server method
*
Expand Down
12 changes: 9 additions & 3 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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);
Expand Down Expand Up @@ -107,7 +109,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);
Expand Down Expand Up @@ -158,7 +162,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);
Expand Down

0 comments on commit 96a684b

Please sign in to comment.