diff --git a/src/AutoDiscover.php b/src/AutoDiscover.php index 29b22268..61fb0af9 100644 --- a/src/AutoDiscover.php +++ b/src/AutoDiscover.php @@ -30,12 +30,6 @@ /** * \Zend\Soap\AutoDiscover * - * @uses \Zend\Server\AbstractServer - * @uses \Zend\Server\Server - * @uses \Zend\Server\Reflection - * @uses \Zend\Soap\AutoDiscover\Exception - * @uses \Zend\Soap\Wsdl - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Soap * @subpackage AutoDiscover @@ -88,13 +82,13 @@ class AutoDiscover implements \Zend\Server\Server * * @var string */ - protected $_wsdlClass = '\Zend\Soap\Wsdl'; + protected $_wsdlClass = 'Zend\Soap\Wsdl'; /** * Constructor * * @param boolean|string|\Zend\Soap\Wsdl\Strategy $strategy - * @param string|\Zend\Uri\Uri $uri + * @param string|Uri\Uri $uri * @param string $wsdlClass */ public function __construct($strategy = true, $uri=null, $wsdlClass=null) @@ -115,7 +109,7 @@ public function __construct($strategy = true, $uri=null, $wsdlClass=null) * Set the location at which the WSDL file will be availabe. * * @throws \Zend\Soap\AutoDiscover\Exception - * @param \Zend\Uri\Uri|string $uri + * @param Uri\Uri|string $uri * @return \Zend\Soap\AutoDiscover */ public function setUri($uri) @@ -138,7 +132,7 @@ public function setUri($uri) /** * Return the current Uri that the SOAP WSDL Service will be located at. * - * @return \Zend\Uri\Uri + * @return Uri\Uri */ public function getUri() { @@ -148,7 +142,7 @@ public function getUri() $schema = $this->getSchema(); $host = $this->getHostName(); $scriptName = $this->getRequestUriWithoutParameters(); - $uri = new Uri\Url($schema . '://' . $host . $scriptName); + $uri = Uri\UriFactory::factory($schema . '://' . $host . $scriptName); $this->setUri($uri); } return $uri; diff --git a/src/Wsdl.php b/src/Wsdl.php index 4e68992d..f60529dd 100644 --- a/src/Wsdl.php +++ b/src/Wsdl.php @@ -23,18 +23,12 @@ */ namespace Zend\Soap; -use Zend\Uri\Url; +use DOMDocument, + Zend\Uri\Uri; /** * \Zend\Soap\Wsdl * - * @uses DOMDocument - * @uses \Zend\Server\Exception - * @uses \Zend\Soap\WsdlException - * @uses \Zend\Soap\Wsdl\Strategy\AbstractStrategy - * @uses \Zend\Soap\Wsdl\Strategy\AnyType - * @uses \Zend\Soap\Wsdl\Strategy\DefaultComplexType - * @uses \Zend\Soap\Wsdl\Strategy\StrategyInterface * @category Zend * @package Zend_Soap * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) @@ -79,13 +73,13 @@ class Wsdl * Constructor * * @param string $name Name of the Web Service being Described - * @param string|\Zend\URL $uri URI where the WSDL will be available + * @param string|Uri $uri URI where the WSDL will be available * @param boolean|string|\Zend\Soap\Wsdl\Strategy $strategy */ public function __construct($name, $uri, $strategy = true) { - if ($uri instanceof URL) { - $uri = $uri->generate(); + if ($uri instanceof Uri) { + $uri = $uri->toString(); } $this->_uri = $uri; @@ -101,7 +95,7 @@ public function __construct($name, $uri, $strategy = true) xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>"; - $this->_dom = new \DOMDocument(); + $this->_dom = new DOMDocument(); if (!$this->_dom->loadXML($wsdl)) { throw new Exception\RuntimeException('Unable to create DomDocument'); } else { @@ -114,13 +108,13 @@ public function __construct($name, $uri, $strategy = true) /** * Set a new uri for this WSDL * - * @param string|\Zend\URL $uri + * @param string|Uri $uri * @return \Zend\Server\Wsdl */ public function setUri($uri) { - if ($uri instanceof URL) { - $uri = $uri->generate(); + if ($uri instanceof Uri) { + $uri = $uri->toString(); } $oldUri = $this->_uri; $this->_uri = $uri; @@ -129,7 +123,7 @@ public function setUri($uri) // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation $xml = $this->_dom->saveXML(); $xml = str_replace($oldUri, $uri, $xml); - $this->_dom = new \DOMDocument(); + $this->_dom = new DOMDocument(); $this->_dom->loadXML($xml); } @@ -361,8 +355,8 @@ public function addSoapBinding($binding, $style = 'document', $transport = 'http */ public function addSoapOperation($binding, $soap_action) { - if ($soap_action instanceof URL) { - $soap_action = $soap_action->generate(); + if ($soap_action instanceof Uri) { + $soap_action = $soap_action->toString(); } $soap_operation = $this->_dom->createElement('soap:operation'); $soap_operation->setAttribute('soapAction', $soap_action); @@ -383,8 +377,8 @@ public function addSoapOperation($binding, $soap_action) */ public function addService($name, $port_name, $binding, $location) { - if ($location instanceof URL) { - $location = $location->generate(); + if ($location instanceof Uri) { + $location = $location->toString(); } $service = $this->_dom->createElement('service'); $service->setAttribute('name', $name); diff --git a/test/AutoDiscoverTest.php b/test/AutoDiscoverTest.php index b5cc5b6b..a19a43f0 100644 --- a/test/AutoDiscoverTest.php +++ b/test/AutoDiscoverTest.php @@ -719,28 +719,28 @@ public function testUsingRequestUriWithoutParametersAsDefault() // Apache $_SERVER = array('REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost'); $server = new AutoDiscover(); - $uri = $server->getUri()->generate(); + $uri = $server->getUri()->toString(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); // Apache plus SSL $_SERVER = array('REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost', 'HTTPS' => 'on'); $server = new AutoDiscover(); - $uri = $server->getUri()->generate(); + $uri = $server->getUri()->toString(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("https://localhost/my_script.php", $uri); // IIS 5 + PHP as FastCGI $_SERVER = array('ORIG_PATH_INFO' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost'); $server = new AutoDiscover(); - $uri = $server->getUri()->generate(); + $uri = $server->getUri()->toString(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); // IIS $_SERVER = array('HTTP_X_REWRITE_URL' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost'); $server = new AutoDiscover(); - $uri = $server->getUri()->generate(); + $uri = $server->getUri()->toString(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); }