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

Commit

Permalink
Merge branch 'master' of git://git.zendframework.com/zf into mikaelkael
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkael committed Jul 7, 2010
2 parents 50418c6 + 490086e commit 8132ce0
Show file tree
Hide file tree
Showing 37 changed files with 944 additions and 1,063 deletions.
75 changes: 38 additions & 37 deletions src/AutoDiscover/AutoDiscover.php → src/AutoDiscover.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,33 @@
/**
* @namespace
*/
namespace Zend\Soap\AutoDiscover;
use Zend\URI;
use Zend\Soap\WSDL;
namespace Zend\Soap;

use Zend\URI,
Zend\Soap\WSDL;

/**
* \Zend\Soap\AutoDiscover\AutoDiscover
* \Zend\Soap\AutoDiscover
*
* @uses \Zend\Server\AbstractServer
* @uses \Zend\Server\ServerInterface
* @uses \Zend\Server\Reflection\Reflection
* @uses \Zend\Server\Server
* @uses \Zend\Server\Reflection
* @uses \Zend\Soap\AutoDiscover\Exception
* @uses \Zend\Soap\WSDL\WSDL
* @uses \Zend\Soap\WSDL
* @uses \Zend\URI\URI
* @category Zend
* @package Zend_Soap
* @subpackage AutoDiscover
*/
class AutoDiscover implements \Zend\Server\ServerInterface
class AutoDiscover implements \Zend\Server\Server
{
/**
* @var \Zend\Soap\WSDL\WSDL
* @var \Zend\Soap\WSDL
*/
protected $_wsdl = null;

/**
* @var \Zend\Server\Reflection\Reflection
* @var \Zend\Server\Reflection
*/
protected $_reflection = null;

Expand Down Expand Up @@ -88,18 +89,18 @@ class AutoDiscover implements \Zend\Server\ServerInterface
*
* @var string
*/
protected $_wsdlClass = '\Zend\Soap\WSDL\WSDL';
protected $_wsdlClass = '\Zend\Soap\WSDL';

/**
* Constructor
*
* @param boolean|string|\Zend\Soap\WSDL\Strategy\StrategyInterface $strategy
* @param boolean|string|\Zend\Soap\WSDL\Strategy $strategy
* @param string|\Zend\URI\URI $uri
* @param string $wsdlClass
*/
public function __construct($strategy = true, $uri=null, $wsdlClass=null)
{
$this->_reflection = new \Zend\Server\Reflection\Reflection();
$this->_reflection = new \Zend\Server\Reflection();
$this->setComplexTypeStrategy($strategy);

if($uri !== null) {
Expand All @@ -116,19 +117,19 @@ public function __construct($strategy = true, $uri=null, $wsdlClass=null)
*
* @throws \Zend\Soap\AutoDiscover\Exception
* @param \Zend\URI\URI|string $uri
* @return \Zend\Soap\AutoDiscover\AutoDiscover
* @return \Zend\Soap\AutoDiscover
*/
public function setUri($uri)
{
if(!is_string($uri) && !($uri instanceof URI\URI)) {
throw new Exception(
'No uri given to \Zend\Soap\AutoDiscover\AutoDiscover::setUri as string or \Zend\URI\URI instance.'
throw new AutoDiscoverException(
'No uri given to \Zend\Soap\AutoDiscover::setUri as string or \Zend\URI\URI instance.'
);
}
$this->_uri = $uri;

// change uri in WSDL file also if existant
if($this->_wsdl instanceof WSDL\WSDL) {
if($this->_wsdl instanceof WSDL) {
$this->_wsdl->setUri($uri);
}

Expand Down Expand Up @@ -159,13 +160,13 @@ public function getUri()
*
* @throws \Zend\Soap\AutoDiscover\Exception
* @param string $wsdlClass
* @return \Zend\Soap\AutoDiscover\AutoDiscover
* @return \Zend\Soap\AutoDiscover
*/
public function setWSDLClass($wsdlClass)
{
if(!is_string($wsdlClass) && !is_subclass_of($wsdlClass, '\Zend\Soap\WSDL\WSDL')) {
throw new Exception(
'No \Zend\Soap\WSDL\WSDL subclass given to \Zend\Soap\AutoDiscover\AutoDiscover::setWSDLClass as string.'
if(!is_string($wsdlClass) && !is_subclass_of($wsdlClass, 'Zend\Soap\WSDL')) {
throw new AutoDiscoverException(
'No \Zend\Soap\WSDL subclass given to Zend\Soap\AutoDiscover::setWSDLClass as string.'
);
}
$this->_wsdlClass = $wsdlClass;
Expand All @@ -190,12 +191,12 @@ public function getWSDLClass()
* 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/".
*
* @param array $operationStyle
* @return \Zend\Soap\AutoDiscover\AutoDiscover
* @return \Zend\Soap\AutoDiscover
*/
public function setOperationBodyStyle(array $operationStyle=array())
{
if(!isset($operationStyle['use'])) {
throw new Exception("Key 'use' is required in Operation soap:body style.");
throw new AutoDiscoverException("Key 'use' is required in Operation soap:body style.");
}
$this->_operationBodyStyle = $operationStyle;
return $this;
Expand All @@ -207,7 +208,7 @@ public function setOperationBodyStyle(array $operationStyle=array())
* By default 'style' is 'rpc' and 'transport' is 'http://schemas.xmlsoap.org/soap/http'.
*
* @param array $bindingStyle
* @return \Zend\Soap\AutoDiscover\AutoDiscover
* @return \Zend\Soap\AutoDiscover
*/
public function setBindingStyle(array $bindingStyle=array())
{
Expand Down Expand Up @@ -275,13 +276,13 @@ protected function getRequestUriWithoutParameters()
/**
* Set the strategy that handles functions and classes that are added AFTER this call.
*
* @param boolean|string|\Zend\Soap\WSDL\Strategy\StrategyInterface $strategy
* @return \Zend\Soap\AutoDiscover\AutoDiscover
* @param boolean|string|\Zend\Soap\WSDL\Strategy $strategy
* @return \Zend\Soap\AutoDiscover
*/
public function setComplexTypeStrategy($strategy)
{
$this->_strategy = $strategy;
if($this->_wsdl instanceof WSDL\WSDL) {
if($this->_wsdl instanceof WSDL) {
$this->_wsdl->setComplexTypeStrategy($strategy);
}

Expand Down Expand Up @@ -333,10 +334,10 @@ public function addFunction($function, $namespace = '')

$uri = $this->getUri();

if (!($this->_wsdl instanceof WSDL\WSDL)) {
if (!($this->_wsdl instanceof WSDL)) {
$parts = explode('.', basename($_SERVER['SCRIPT_NAME']));
$name = $parts[0];
$wsdl = new WSDL\WSDL($name, $uri, $this->_strategy);
$wsdl = new WSDL($name, $uri, $this->_strategy);

// The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023)
$wsdl->addSchemaTypeSection();
Expand All @@ -361,7 +362,7 @@ public function addFunction($function, $namespace = '')
* Add a function to the WSDL document.
*
* @param $function \Zend\Server\Reflection\AbstractFunction function to add
* @param $wsdl \Zend\Soap\WSDL\WSDL WSDL document
* @param $wsdl \Zend\Soap\WSDL WSDL document
* @param $port object wsdl:portType
* @param $binding object wsdl:binding
* @return void
Expand All @@ -381,7 +382,7 @@ protected function _addFunctionToWSDL($function, $wsdl, $port, $binding)
}
}
if ($prototype === null) {
throw new Exception("No prototypes could be found for the '" . $function->getName() . "' function");
throw new AutoDiscoverException("No prototypes could be found for the '" . $function->getName() . "' function");
}

// Add the input message (parameters)
Expand Down Expand Up @@ -475,7 +476,7 @@ protected function _addFunctionToWSDL($function, $wsdl, $port, $binding)
*/
public function fault($fault = null, $code = null)
{
throw new Exception('Function has no use in AutoDiscover.');
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
}

/**
Expand All @@ -501,7 +502,7 @@ public function dump($filename)
if($this->_wsdl !== null) {
return $this->_wsdl->dump($filename);
} else {
throw new Exception('Cannot dump autodiscovered contents, WSDL file has not been generated yet.');
throw new AutoDiscoverException('Cannot dump autodiscovered contents, WSDL file has not been generated yet.');
}
}

Expand All @@ -513,7 +514,7 @@ public function toXml()
if($this->_wsdl !== null) {
return $this->_wsdl->toXml();
} else {
throw new Exception('Cannot return autodiscovered contents, WSDL file has not been generated yet.');
throw new AutoDiscoverException('Cannot return autodiscovered contents, WSDL file has not been generated yet.');
}
}

Expand All @@ -534,7 +535,7 @@ public function getFunctions()
*/
public function loadFunctions($definition)
{
throw new Exception('Function has no use in AutoDiscover.');
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
}

/**
Expand All @@ -544,7 +545,7 @@ public function loadFunctions($definition)
*/
public function setPersistence($mode)
{
throw new Exception('Function has no use in AutoDiscover.');
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
}

/**
Expand All @@ -555,7 +556,7 @@ public function setPersistence($mode)
*/
public function getType($type)
{
if (!($this->_wsdl instanceof WSDL\WSDL)) {
if (!($this->_wsdl instanceof WSDL)) {
/** @todo Exception throwing may be more correct */

// WSDL is not defined yet, so we can't recognize type in context of current service
Expand Down
35 changes: 35 additions & 0 deletions src/AutoDiscoverException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Soap
* @subpackage AutoDiscover
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @namespace
*/
namespace Zend\Soap;

/**
* @uses \Zend\Soap\Exception
* @package Zend_Soap
* @subpackage AutoDiscover
*/
class AutoDiscoverException extends Exception
{
}
Loading

0 comments on commit 8132ce0

Please sign in to comment.