diff --git a/src/AutoDiscover.php b/src/AutoDiscover.php index a385f5aa..d7b7cb65 100644 --- a/src/AutoDiscover.php +++ b/src/AutoDiscover.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage AutoDiscover - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/AutoDiscover/DiscoveryStrategy.php b/src/AutoDiscover/DiscoveryStrategy.php index 4f00cb0d..f9d2dd99 100644 --- a/src/AutoDiscover/DiscoveryStrategy.php +++ b/src/AutoDiscover/DiscoveryStrategy.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface DiscoveryStrategy diff --git a/src/AutoDiscover/DiscoveryStrategy/ReflectionDiscovery.php b/src/AutoDiscover/DiscoveryStrategy/ReflectionDiscovery.php index 2cab7a14..7431d185 100644 --- a/src/AutoDiscover/DiscoveryStrategy/ReflectionDiscovery.php +++ b/src/AutoDiscover/DiscoveryStrategy/ReflectionDiscovery.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -35,7 +35,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/Client.php b/src/Client.php index fb508bdd..b0de2cd2 100644 --- a/src/Client.php +++ b/src/Client.php @@ -15,29 +15,24 @@ * @category Zend * @package Zend_Soap * @subpackage Client - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @namespace - */ namespace Zend\Soap; +use Zend\Server\Client as ServerClient; + /** * \Zend\Soap\Client\Client * - * @uses \Zend\Soap\Client\Common - * @uses \Zend\Soap\Client\Exception - * @uses \Zend\Soap\Client\Local - * @uses \Zend\Soap\Server * @category Zend * @package Zend_Soap * @subpackage Client - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Client +class Client implements ServerClient { /** * Encoding @@ -1101,6 +1096,17 @@ public function __call($name, $arguments) return $this->_preProcessResult($result); } + /** + * Send an RPC request to the service for a specific method. + * + * @param string $method Name of the method we want to call. + * @param array $params List of parameters for the method. + * @return mixed Returned results. + */ + public function call($method, $params = array()) + { + return call_user_func_array(array($this, '__call'), $params); + } /** * Return a list of available functions diff --git a/src/Client/Common.php b/src/Client/Common.php index 58632a64..fdd4d846 100644 --- a/src/Client/Common.php +++ b/src/Client/Common.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage Client - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/Client/DotNet.php b/src/Client/DotNet.php index a122dac7..5098b820 100644 --- a/src/Client/DotNet.php +++ b/src/Client/DotNet.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage Client - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/Client/Local.php b/src/Client/Local.php index ca2e5d06..b35c39b3 100644 --- a/src/Client/Local.php +++ b/src/Client/Local.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage Client - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/Exception.php b/src/Exception.php index 84b67bb6..c255c90a 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage AutoDiscover - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Soap * @subpackage AutoDiscover - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Exception diff --git a/src/Exception/AutoDiscoverException.php b/src/Exception/AutoDiscoverException.php index ab0d82f4..1173ae44 100644 --- a/src/Exception/AutoDiscoverException.php +++ b/src/Exception/AutoDiscoverException.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage AutoDiscover - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php new file mode 100644 index 00000000..8349bd90 --- /dev/null +++ b/src/Exception/BadMethodCallException.php @@ -0,0 +1,9 @@ +setObject($class); + } + if (!is_string($class)) { throw new Exception\InvalidArgumentException('Invalid class argument (' . gettype($class) . ')'); } @@ -555,10 +559,9 @@ public function setClass($class, $namespace = '', $argv = null) } $this->_class = $class; - if (1 < func_num_args()) { + if (2 < func_num_args()) { $argv = func_get_args(); - array_shift($argv); - $this->_classArgs = $argv; + $this->_classArgs = array_slice($argv, 2); } return $this; @@ -705,7 +708,7 @@ public function getLastRequest() * @param boolean $flag * @return \Zend\Soap\Server */ - public function setReturnResponse($flag) + public function setReturnResponse($flag = true) { $this->_returnResponse = ($flag) ? true : false; return $this; @@ -726,7 +729,7 @@ public function getReturnResponse() * * @return string */ - public function getLastResponse() + public function getResponse() { return $this->_response; } @@ -806,7 +809,7 @@ public function handle($request = null) ob_start(); if($setRequestException instanceof \Exception) { // Send SOAP fault message if we've catched exception - $soap->fault("Sender", $setRequestException->getMessage()); + $soap->fault('Sender', $setRequestException->getMessage()); } else { try { $soap->handle($this->_request); @@ -936,6 +939,6 @@ public function fault($fault = null, $code = "Receiver") */ public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null) { - throw $this->fault($errstr, "Receiver"); + throw $this->fault($errstr, 'Receiver'); } } diff --git a/src/Server/DocumentLiteralWrapper.php b/src/Server/DocumentLiteralWrapper.php new file mode 100644 index 00000000..0d5da93b --- /dev/null +++ b/src/Server/DocumentLiteralWrapper.php @@ -0,0 +1,184 @@ +x = 10; + * $addRequest->y = 20; + * + * This object does not match the signature of the server-side + * MyCalculatorService and lead to failure. + * + * Also the response object in this case is supposed to be an array + * or object with a property "addResult": + * + * $addResponse = new \stdClass; + * $addResponse->addResult = 30; + * + * To keep your service object code free from this implementation detail + * of SOAP this wrapper service handles the parsing between the formats. + * + * @example + * + * $service = new MyCalculatorService(); + * $soap = new \Zend\Soap\Server($wsdlFile); + * $soap->setObject(new \Zend\Soap\Server\DocumentLiteralWrapper($service)); + * $soap->handle(); + * + * @uses ReflectionClass + * @category Zend + * @package Zend_Soap + * @subpackage Server + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class DocumentLiteralWrapper +{ + /** + * @var object + */ + protected $_object; + + /** + * @var ReflectionObject + */ + protected $_reflection; + + /** + * Pass Service object to the constructor + * + * @param object $object + */ + public function __construct($object) + { + $this->_object = $object; + $this->_reflection = new \ReflectionObject($this->_object); + } + + /** + * Proxy method that does the heavy document/literal decomposing. + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + $this->_assertOnlyOneArgument($args); + $this->_assertServiceDelegateHasMethod($method); + + $delegateArgs = $this->_parseArguments($method, $args[0]); + $ret = call_user_func_array(array($this->_object, $method), $delegateArgs); + return $this->_getResultMessage($method, $ret); + } + + /** + * Parse the document/literal wrapper into arguments to call the real + * service. + * + * @param string $method + * @param object $document + * @return array + */ + protected function _parseArguments($method, $document) + { + $reflMethod = $this->_reflection->getMethod($method); + $params = array(); + foreach ($reflMethod->getParameters() as $param) { + $params[$param->getName()] = $param; + } + + $delegateArgs = array(); + foreach (get_object_vars($document) as $argName => $argValue) { + if (!isset($params[$argName])) { + throw new UnexpectedValueException(sprintf( + "Recieved unknown argument %s which is not an argument to %s::%s", + get_class($this->_object), $method + )); + } + $delegateArgs[$params[$argName]->getPosition()] = $argValue; + } + return $delegateArgs; + } + + protected function _getResultMessage($method, $ret) + { + return array($method.'Result' => $ret); + } + + protected function _assertServiceDelegateHasMethod($method) + { + if ( !$this->_reflection->hasMethod($method) ) { + throw new BadMethodCallException(sprintf( + "Method %s does not exist on delegate object %s", + $method, get_class($this->_object) + )); + } + } + + protected function _assertOnlyOneArgument($args) + { + if (count($args) != 1) { + throw new UnexpectedValueException(sprintf( + "Expecting exactly one argument that is the document/literal wrapper, got %d", + count($args))); + } + } +} + diff --git a/src/Wsdl.php b/src/Wsdl.php index 37b48104..ad424799 100644 --- a/src/Wsdl.php +++ b/src/Wsdl.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Soap - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Soap - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Wsdl @@ -540,28 +540,24 @@ public function getType($type) case 'string': case 'str': return 'xsd:string'; - break; + case 'long': + return 'xsd:long'; case 'int': case 'integer': return 'xsd:int'; - break; case 'float': - case 'double': return 'xsd:float'; - break; + case 'double': + return 'xsd:double'; case 'boolean': case 'bool': return 'xsd:boolean'; - break; case 'array': return 'soap-enc:Array'; - break; case 'object': return 'xsd:struct'; - break; case 'mixed': return 'xsd:anyType'; - break; case 'void': return ''; default: @@ -603,7 +599,8 @@ public function translateType($type) $type = substr($type, 1); } - if ($pos = strrpos($type, '\\')) { + $pos = strrpos($type, '\\'); + if ($pos) { $type = substr($type, $pos+1); } diff --git a/src/Wsdl/ComplexTypeStrategy.php b/src/Wsdl/ComplexTypeStrategy.php index ba86ed79..3e1d9725 100644 --- a/src/Wsdl/ComplexTypeStrategy.php +++ b/src/Wsdl/ComplexTypeStrategy.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,7 +30,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface ComplexTypeStrategy diff --git a/src/Wsdl/ComplexTypeStrategy/AbstractComplexTypeStrategy.php b/src/Wsdl/ComplexTypeStrategy/AbstractComplexTypeStrategy.php index 286dc126..60977177 100644 --- a/src/Wsdl/ComplexTypeStrategy/AbstractComplexTypeStrategy.php +++ b/src/Wsdl/ComplexTypeStrategy/AbstractComplexTypeStrategy.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class AbstractComplexTypeStrategy implements ComplexTypeStrategy diff --git a/src/Wsdl/ComplexTypeStrategy/AnyType.php b/src/Wsdl/ComplexTypeStrategy/AnyType.php index 7142d21b..ad4c44b3 100644 --- a/src/Wsdl/ComplexTypeStrategy/AnyType.php +++ b/src/Wsdl/ComplexTypeStrategy/AnyType.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class AnyType implements ComplexTypeStrategy diff --git a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php index 4b421314..a42a9b17 100644 --- a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php +++ b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeComplex.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class ArrayOfTypeComplex extends DefaultComplexType diff --git a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php index d88e4ea6..f6fdab4d 100644 --- a/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php +++ b/src/Wsdl/ComplexTypeStrategy/ArrayOfTypeSequence.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Soap - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class ArrayOfTypeSequence extends DefaultComplexType diff --git a/src/Wsdl/ComplexTypeStrategy/Composite.php b/src/Wsdl/ComplexTypeStrategy/Composite.php index 33437aa6..a85ae677 100644 --- a/src/Wsdl/ComplexTypeStrategy/Composite.php +++ b/src/Wsdl/ComplexTypeStrategy/Composite.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -36,7 +36,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Composite implements ComplexTypeStrategy diff --git a/src/Wsdl/ComplexTypeStrategy/DefaultComplexType.php b/src/Wsdl/ComplexTypeStrategy/DefaultComplexType.php index b48c9d1f..17238d09 100644 --- a/src/Wsdl/ComplexTypeStrategy/DefaultComplexType.php +++ b/src/Wsdl/ComplexTypeStrategy/DefaultComplexType.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Soap * @subpackage WSDL - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class DefaultComplexType extends AbstractComplexTypeStrategy diff --git a/test/AutoDiscover/OnlineTest.php b/test/AutoDiscover/OnlineTest.php index 5ac83013..dde513e2 100644 --- a/test/AutoDiscover/OnlineTest.php +++ b/test/AutoDiscover/OnlineTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Soap */ diff --git a/test/AutoDiscoverTest.php b/test/AutoDiscoverTest.php index f3490fa5..c3602a1f 100644 --- a/test/AutoDiscoverTest.php +++ b/test/AutoDiscoverTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -38,7 +38,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Soap */ diff --git a/test/ClientTest.php b/test/ClientTest.php index 8f43ae47..253a537a 100644 --- a/test/ClientTest.php +++ b/test/ClientTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Soap */ diff --git a/test/Server/DocumentLiteralWrapperTest.php b/test/Server/DocumentLiteralWrapperTest.php new file mode 100644 index 00000000..23a5f6f8 --- /dev/null +++ b/test/Server/DocumentLiteralWrapperTest.php @@ -0,0 +1,57 @@ +setObject(new DocumentLiteralWrapper(new MyCalculatorService)); + + // The local client needs an abstraction for this pattern as well. + // This is just a test so we use the messy way. + $client = new SoapClient($server, __DIR__ . self::WSDL); + $ret = $client->add(array('x' => 10, 'y' => 20)); + + $this->assertInstanceOf('stdClass', $ret); + $this->assertEquals(30, $ret->addResult); + } +} diff --git a/test/Server/_files/calculator.wsdl b/test/Server/_files/calculator.wsdl new file mode 100644 index 00000000..4d170db4 --- /dev/null +++ b/test/Server/_files/calculator.wsdl @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + @param int $x + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/ServerTest.php b/test/ServerTest.php index c253b215..249bdc51 100644 --- a/test/ServerTest.php +++ b/test/ServerTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -36,7 +36,7 @@ * @package Zend_Soap * @subpackage UnitTests * @uses Zend_Server_Interface - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Soap * @group Zend_Soap_Server @@ -324,6 +324,19 @@ public function testSetClass() $this->assertSame($server, $r); } + /** + * @group PR-706 + */ + public function testSetClassWithObject() + { + $server = new Server(); + + // Correct class name should pass + $object = new \ZendTest\Soap\TestAsset\ServerTestClass(); + $r = $server->setClass($object); + $this->assertSame($server, $r); + } + public function testSetClassTwiceThrowsException() { $server = new Server(); @@ -341,7 +354,7 @@ public function testSetClassWithArguments() $server = new Server(); // Correct class name should pass - $r = $server->setClass('\ZendTest\Soap\TestAsset\ServerTestClass', 1, 2, 3, 4); + $r = $server->setClass('\ZendTest\Soap\TestAsset\ServerTestClass', null, 1, 2, 3, 4); $this->assertSame($server, $r); } @@ -586,7 +599,7 @@ public function testGetLastResponse() $server->handle($request); - $this->assertEquals($expectedResponse, $server->getLastResponse()); + $this->assertEquals($expectedResponse, $server->getResponse()); } public function testHandle() diff --git a/test/TestAsset/MyCalculatorService.php b/test/TestAsset/MyCalculatorService.php new file mode 100644 index 00000000..853b0109 --- /dev/null +++ b/test/TestAsset/MyCalculatorService.php @@ -0,0 +1,41 @@ +assertEquals('xsd:int', $wsdl->getType('int'), 'xsd:int detection failed.'); $this->assertEquals('xsd:int', $wsdl->getType('integer'), 'xsd:int detection failed.'); $this->assertEquals('xsd:float', $wsdl->getType('float'), 'xsd:float detection failed.'); - $this->assertEquals('xsd:float', $wsdl->getType('double'), 'xsd:float detection failed.'); + $this->assertEquals('xsd:double', $wsdl->getType('double'), 'xsd:double detection failed.'); $this->assertEquals('xsd:boolean', $wsdl->getType('boolean'), 'xsd:boolean detection failed.'); $this->assertEquals('xsd:boolean', $wsdl->getType('bool'), 'xsd:boolean detection failed.'); $this->assertEquals('soap-enc:Array', $wsdl->getType('array'), 'soap-enc:Array detection failed.'); @@ -619,7 +619,16 @@ function testCaseOfDocBlockParamsDosNotMatterForSoapTypeDetectionZf3910() $this->assertEquals("xsd:int", $wsdl->getType("iNt")); $this->assertEquals("xsd:int", $wsdl->getType("INTEGER")); $this->assertEquals("xsd:float", $wsdl->getType("FLOAT")); - $this->assertEquals("xsd:float", $wsdl->getType("douBLE")); + $this->assertEquals("xsd:double", $wsdl->getType("douBLE")); + } + + /** + * @group ZF-11937 + */ + public function testWsdlGetTypeWillAllowLongType() + { + $wsdl = new Wsdl('MyService', 'http://localhost/MyService.php'); + $this->assertEquals("xsd:long", $wsdl->getType("long")); } /** diff --git a/test/_files/commontypes.php b/test/_files/commontypes.php index a8e57081..b0fe768f 100644 --- a/test/_files/commontypes.php +++ b/test/_files/commontypes.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: commontypes.php 21858 2010-04-15 19:58:12Z beberlei $ */ @@ -118,7 +118,7 @@ function Zend_Soap_AutoDiscover_TestFunc9($foo, $bar) * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_TestFixingMultiplePrototypes @@ -141,7 +141,7 @@ function testFunc($a=100, $b=200, $d=300) * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_Test { @@ -206,7 +206,7 @@ class Zend_Soap_AutoDiscoverTestClass1 * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscoverTestClass2 @@ -245,7 +245,7 @@ public function addMultiple($test) * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTypeB @@ -264,7 +264,7 @@ class Zend_Soap_Wsdl_ComplexTypeB * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTypeA @@ -279,7 +279,7 @@ class Zend_Soap_Wsdl_ComplexTypeA * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTest @@ -294,7 +294,7 @@ class Zend_Soap_Wsdl_ComplexTest * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexObjectStructure @@ -324,7 +324,7 @@ class Zend_Soap_Wsdl_ComplexObjectStructure * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexObjectWithObjectStructure @@ -339,7 +339,7 @@ class Zend_Soap_Wsdl_ComplexObjectWithObjectStructure * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_MyService @@ -369,7 +369,7 @@ public function baz($baz) { * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_MyServiceSequence @@ -406,7 +406,7 @@ public function bazNested($baz) { * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_MyResponse @@ -421,7 +421,7 @@ class Zend_Soap_AutoDiscover_MyResponse * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_Recursion @@ -449,7 +449,7 @@ function Zend_Soap_AutoDiscover_OneWay($message) * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_AutoDiscover_NoReturnType diff --git a/test/_files/fulltests/server1.php b/test/_files/fulltests/server1.php index 556c7dd9..a028f766 100644 --- a/test/_files/fulltests/server1.php +++ b/test/_files/fulltests/server1.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: server1.php 20096 2010-01-06 02:05:09Z bkarwin $ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Service_Server1 @@ -61,7 +61,7 @@ public function request($request) * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTypeB @@ -80,7 +80,7 @@ class Zend_Soap_Wsdl_ComplexTypeB * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTypeA diff --git a/test/_files/fulltests/server2.php b/test/_files/fulltests/server2.php index 83477a47..28f32204 100644 --- a/test/_files/fulltests/server2.php +++ b/test/_files/fulltests/server2.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: server2.php 20096 2010-01-06 02:05:09Z bkarwin $ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Wsdl_ComplexTypeB @@ -47,7 +47,7 @@ class Zend_Soap_Wsdl_ComplexTypeB * @category Zend * @package Zend_Soap * @subpackage UnitTests - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Soap_Service_Server2