web/lib/Zend/Soap/AutoDiscover.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Soap
       
    17  * @subpackage AutoDiscover
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: AutoDiscover.php 23338 2010-11-15 14:59:33Z alexander $
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Server_Interface
       
    25  */
       
    26 require_once 'Zend/Server/Interface.php';
       
    27 /**
       
    28  * @see Zend_Soap_Wsdl
       
    29  */
       
    30 require_once 'Zend/Soap/Wsdl.php';
       
    31 /**
       
    32  * @see Zend_Server_Reflection
       
    33  */
       
    34 require_once 'Zend/Server/Reflection.php';
       
    35 /**
       
    36  * @see Zend_Server_Abstract
       
    37  */
       
    38 require_once 'Zend/Server/Abstract.php';
       
    39 /**
       
    40  * @see Zend_Uri
       
    41  */
       
    42 require_once 'Zend/Uri.php';
       
    43 
       
    44 /**
       
    45  * Zend_Soap_AutoDiscover
       
    46  *
       
    47  * @category   Zend
       
    48  * @package    Zend_Soap
       
    49  * @subpackage AutoDiscover
       
    50  */
       
    51 class Zend_Soap_AutoDiscover implements Zend_Server_Interface
       
    52 {
       
    53     /**
       
    54      * @var Zend_Soap_Wsdl
       
    55      */
       
    56     protected $_wsdl = null;
       
    57 
       
    58     /**
       
    59      * @var Zend_Server_Reflection
       
    60      */
       
    61     protected $_reflection = null;
       
    62 
       
    63     /**
       
    64      * @var array
       
    65      */
       
    66     protected $_functions = array();
       
    67 
       
    68     /**
       
    69      * @var boolean
       
    70      */
       
    71     protected $_strategy;
       
    72 
       
    73     /**
       
    74      * Url where the WSDL file will be available at.
       
    75      *
       
    76      * @var WSDL Uri
       
    77      */
       
    78     protected $_uri;
       
    79 
       
    80     /**
       
    81      * soap:body operation style options
       
    82      *
       
    83      * @var array
       
    84      */
       
    85     protected $_operationBodyStyle = array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/");
       
    86 
       
    87     /**
       
    88      * soap:operation style
       
    89      *
       
    90      * @var array
       
    91      */
       
    92     protected $_bindingStyle = array('style' => 'rpc', 'transport' => 'http://schemas.xmlsoap.org/soap/http');
       
    93 
       
    94     /**
       
    95      * Name of the class to handle the WSDL creation.
       
    96      *
       
    97      * @var string
       
    98      */
       
    99     protected $_wsdlClass = 'Zend_Soap_Wsdl';
       
   100 
       
   101     /**
       
   102      * Constructor
       
   103      *
       
   104      * @param boolean|string|Zend_Soap_Wsdl_Strategy_Interface $strategy
       
   105      * @param string|Zend_Uri $uri
       
   106      * @param string $wsdlClass
       
   107      */
       
   108     public function __construct($strategy = true, $uri=null, $wsdlClass=null)
       
   109     {
       
   110         $this->_reflection = new Zend_Server_Reflection();
       
   111         $this->setComplexTypeStrategy($strategy);
       
   112 
       
   113         if($uri !== null) {
       
   114             $this->setUri($uri);
       
   115         }
       
   116 
       
   117         if($wsdlClass !== null) {
       
   118             $this->setWsdlClass($wsdlClass);
       
   119         }
       
   120     }
       
   121 
       
   122     /**
       
   123      * Set the location at which the WSDL file will be availabe.
       
   124      *
       
   125      * @see Zend_Soap_Exception
       
   126      * @param  Zend_Uri|string $uri
       
   127      * @return Zend_Soap_AutoDiscover
       
   128      * @throws Zend_Soap_AutoDiscover_Exception
       
   129      */
       
   130     public function setUri($uri)
       
   131     {
       
   132         if (!is_string($uri) && !($uri instanceof Zend_Uri)) {
       
   133             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   134             throw new Zend_Soap_AutoDiscover_Exception("No uri given to Zend_Soap_AutoDiscover::setUri as string or Zend_Uri instance.");
       
   135         }
       
   136         $this->_uri = $uri;
       
   137 
       
   138         // change uri in WSDL file also if existant
       
   139         if ($this->_wsdl instanceof Zend_Soap_Wsdl) {
       
   140             $this->_wsdl->setUri($uri);
       
   141         }
       
   142 
       
   143         return $this;
       
   144     }
       
   145 
       
   146     /**
       
   147      * Return the current Uri that the SOAP WSDL Service will be located at.
       
   148      *
       
   149      * @return Zend_Uri
       
   150      */
       
   151     public function getUri()
       
   152     {
       
   153         if($this->_uri !== null) {
       
   154             $uri = $this->_uri;
       
   155         } else {
       
   156             $schema     = $this->getSchema();
       
   157             $host       = $this->getHostName();
       
   158             $scriptName = $this->getRequestUriWithoutParameters();
       
   159             $uri = Zend_Uri::factory($schema . '://' . $host . $scriptName);
       
   160             $this->setUri($uri);
       
   161         }
       
   162         return $uri;
       
   163     }
       
   164 
       
   165     /**
       
   166      * Set the name of the WSDL handling class.
       
   167      *
       
   168      * @see Zend_Soap_Exception
       
   169      * @see Zend_Soap_Exception
       
   170      * @param  string $wsdlClass
       
   171      * @return Zend_Soap_AutoDiscover
       
   172      * @throws Zend_Soap_AutoDiscover_Exception
       
   173      */
       
   174     public function setWsdlClass($wsdlClass)
       
   175     {
       
   176         if (!is_string($wsdlClass) && !is_subclass_of($wsdlClass, 'Zend_Soap_Wsdl')) {
       
   177             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   178             throw new Zend_Soap_AutoDiscover_Exception("No Zend_Soap_Wsdl subclass given to Zend_Soap_AutoDiscover::setWsdlClass as string.");
       
   179         }
       
   180         $this->_wsdlClass = $wsdlClass;
       
   181 
       
   182         return $this;
       
   183     }
       
   184 
       
   185     /**
       
   186      * Return the name of the WSDL handling class.
       
   187      *
       
   188      * @return string
       
   189      */
       
   190     public function getWsdlClass()
       
   191     {
       
   192         return $this->_wsdlClass;
       
   193     }
       
   194 
       
   195     /**
       
   196      * Set options for all the binding operations soap:body elements.
       
   197      *
       
   198      * By default the options are set to 'use' => 'encoded' and
       
   199      * 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/".
       
   200      *
       
   201      * @see    Zend_Soap_AutoDiscover_Exception
       
   202      * @param  array $operationStyle
       
   203      * @return Zend_Soap_AutoDiscover
       
   204      * @throws Zend_Soap_AutoDiscover_Exception
       
   205      */
       
   206     public function setOperationBodyStyle(array $operationStyle=array())
       
   207     {
       
   208         if(!isset($operationStyle['use'])) {
       
   209             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   210             throw new Zend_Soap_AutoDiscover_Exception("Key 'use' is required in Operation soap:body style.");
       
   211         }
       
   212         $this->_operationBodyStyle = $operationStyle;
       
   213         return $this;
       
   214     }
       
   215 
       
   216     /**
       
   217      * Set Binding soap:binding style.
       
   218      *
       
   219      * By default 'style' is 'rpc' and 'transport' is 'http://schemas.xmlsoap.org/soap/http'.
       
   220      *
       
   221      * @param  array $bindingStyle
       
   222      * @return Zend_Soap_AutoDiscover
       
   223      */
       
   224     public function setBindingStyle(array $bindingStyle=array())
       
   225     {
       
   226         if(isset($bindingStyle['style'])) {
       
   227             $this->_bindingStyle['style'] = $bindingStyle['style'];
       
   228         }
       
   229         if(isset($bindingStyle['transport'])) {
       
   230             $this->_bindingStyle['transport'] = $bindingStyle['transport'];
       
   231         }
       
   232         return $this;
       
   233     }
       
   234 
       
   235     /**
       
   236      * Detect and returns the current HTTP/HTTPS Schema
       
   237      *
       
   238      * @return string
       
   239      */
       
   240     protected function getSchema()
       
   241     {
       
   242         $schema = "http";
       
   243         if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
       
   244             $schema = 'https';
       
   245         }
       
   246         return $schema;
       
   247     }
       
   248 
       
   249     /**
       
   250      * Detect and return the current hostname
       
   251      *
       
   252      * @return string
       
   253      */
       
   254     protected function getHostName()
       
   255     {
       
   256         if(isset($_SERVER['HTTP_HOST'])) {
       
   257             $host = $_SERVER['HTTP_HOST'];
       
   258         } else {
       
   259             $host = $_SERVER['SERVER_NAME'];
       
   260         }
       
   261         return $host;
       
   262     }
       
   263 
       
   264     /**
       
   265      * Detect and return the current script name without parameters
       
   266      *
       
   267      * @return string
       
   268      */
       
   269     protected function getRequestUriWithoutParameters()
       
   270     {
       
   271         if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
       
   272             $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
       
   273         } elseif (isset($_SERVER['REQUEST_URI'])) {
       
   274             $requestUri = $_SERVER['REQUEST_URI'];
       
   275         } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI
       
   276             $requestUri = $_SERVER['ORIG_PATH_INFO'];
       
   277         } else {
       
   278             $requestUri = $_SERVER['SCRIPT_NAME'];
       
   279         }
       
   280         if( ($pos = strpos($requestUri, "?")) !== false) {
       
   281             $requestUri = substr($requestUri, 0, $pos);
       
   282         }
       
   283 
       
   284         return $requestUri;
       
   285     }
       
   286 
       
   287     /**
       
   288      * Set the strategy that handles functions and classes that are added AFTER this call.
       
   289      *
       
   290      * @param  boolean|string|Zend_Soap_Wsdl_Strategy_Interface $strategy
       
   291      * @return Zend_Soap_AutoDiscover
       
   292      */
       
   293     public function setComplexTypeStrategy($strategy)
       
   294     {
       
   295         $this->_strategy = $strategy;
       
   296         if($this->_wsdl instanceof  Zend_Soap_Wsdl) {
       
   297             $this->_wsdl->setComplexTypeStrategy($strategy);
       
   298         }
       
   299 
       
   300         return $this;
       
   301     }
       
   302 
       
   303     /**
       
   304      * Set the Class the SOAP server will use
       
   305      *
       
   306      * @param string $class Class Name
       
   307      * @param string $namespace Class Namspace - Not Used
       
   308      * @param array $argv Arguments to instantiate the class - Not Used
       
   309      * @return Zend_Soap_AutoDiscover
       
   310      */
       
   311     public function setClass($class, $namespace = '', $argv = null)
       
   312     {
       
   313         $uri = $this->getUri();
       
   314 
       
   315         $wsdl = new $this->_wsdlClass($class, $uri, $this->_strategy);
       
   316 
       
   317         // The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023)
       
   318         $wsdl->addSchemaTypeSection();
       
   319 
       
   320         $port = $wsdl->addPortType($class . 'Port');
       
   321         $binding = $wsdl->addBinding($class . 'Binding', 'tns:' .$class. 'Port');
       
   322 
       
   323         $wsdl->addSoapBinding($binding, $this->_bindingStyle['style'], $this->_bindingStyle['transport']);
       
   324         $wsdl->addService($class . 'Service', $class . 'Port', 'tns:' . $class . 'Binding', $uri);
       
   325         foreach ($this->_reflection->reflectClass($class)->getMethods() as $method) {
       
   326             $this->_addFunctionToWsdl($method, $wsdl, $port, $binding);
       
   327         }
       
   328         $this->_wsdl = $wsdl;
       
   329 
       
   330         return $this;
       
   331     }
       
   332 
       
   333     /**
       
   334      * Add a Single or Multiple Functions to the WSDL
       
   335      *
       
   336      * @param string $function Function Name
       
   337      * @param string $namespace Function namespace - Not Used
       
   338      * @return Zend_Soap_AutoDiscover
       
   339      */
       
   340     public function addFunction($function, $namespace = '')
       
   341     {
       
   342         static $port;
       
   343         static $operation;
       
   344         static $binding;
       
   345 
       
   346         if (!is_array($function)) {
       
   347             $function = (array) $function;
       
   348         }
       
   349 
       
   350         $uri = $this->getUri();
       
   351 
       
   352         if (!($this->_wsdl instanceof Zend_Soap_Wsdl)) {
       
   353             $parts = explode('.', basename($_SERVER['SCRIPT_NAME']));
       
   354             $name = $parts[0];
       
   355             $wsdl = new Zend_Soap_Wsdl($name, $uri, $this->_strategy);
       
   356 
       
   357             // The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023)
       
   358             $wsdl->addSchemaTypeSection();
       
   359 
       
   360             $port = $wsdl->addPortType($name . 'Port');
       
   361             $binding = $wsdl->addBinding($name . 'Binding', 'tns:' .$name. 'Port');
       
   362 
       
   363             $wsdl->addSoapBinding($binding, $this->_bindingStyle['style'], $this->_bindingStyle['transport']);
       
   364             $wsdl->addService($name . 'Service', $name . 'Port', 'tns:' . $name . 'Binding', $uri);
       
   365         } else {
       
   366             $wsdl = $this->_wsdl;
       
   367         }
       
   368 
       
   369         foreach ($function as $func) {
       
   370             $method = $this->_reflection->reflectFunction($func);
       
   371             $this->_addFunctionToWsdl($method, $wsdl, $port, $binding);
       
   372         }
       
   373         $this->_wsdl = $wsdl;
       
   374 
       
   375         return $this;
       
   376     }
       
   377 
       
   378     /**
       
   379      * Add a function to the WSDL document.
       
   380      *
       
   381      * @param $function Zend_Server_Reflection_Function_Abstract function to add
       
   382      * @param $wsdl Zend_Soap_Wsdl WSDL document
       
   383      * @param $port object wsdl:portType
       
   384      * @param $binding object wsdl:binding
       
   385      * @return void
       
   386      */
       
   387     protected function _addFunctionToWsdl($function, $wsdl, $port, $binding)
       
   388     {
       
   389         $uri = $this->getUri();
       
   390 
       
   391         // We only support one prototype: the one with the maximum number of arguments
       
   392         $prototype = null;
       
   393         $maxNumArgumentsOfPrototype = -1;
       
   394         foreach ($function->getPrototypes() as $tmpPrototype) {
       
   395             $numParams = count($tmpPrototype->getParameters());
       
   396             if ($numParams > $maxNumArgumentsOfPrototype) {
       
   397                 $maxNumArgumentsOfPrototype = $numParams;
       
   398                 $prototype = $tmpPrototype;
       
   399             }
       
   400         }
       
   401         if ($prototype === null) {
       
   402             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   403             throw new Zend_Soap_AutoDiscover_Exception("No prototypes could be found for the '" . $function->getName() . "' function");
       
   404         }
       
   405 
       
   406         // Add the input message (parameters)
       
   407         $args = array();
       
   408         if ($this->_bindingStyle['style'] == 'document') {
       
   409             // Document style: wrap all parameters in a sequence element
       
   410             $sequence = array();
       
   411             foreach ($prototype->getParameters() as $param) {
       
   412                 $sequenceElement = array(
       
   413                     'name' => $param->getName(),
       
   414                     'type' => $wsdl->getType($param->getType())
       
   415                 );
       
   416                 if ($param->isOptional()) {
       
   417                     $sequenceElement['nillable'] = 'true';
       
   418                 }
       
   419                 $sequence[] = $sequenceElement;
       
   420             }
       
   421             $element = array(
       
   422                 'name' => $function->getName(),
       
   423                 'sequence' => $sequence
       
   424             );
       
   425             // Add the wrapper element part, which must be named 'parameters'
       
   426             $args['parameters'] = array('element' => $wsdl->addElement($element));
       
   427         } else {
       
   428             // RPC style: add each parameter as a typed part
       
   429             foreach ($prototype->getParameters() as $param) {
       
   430                 $args[$param->getName()] = array('type' => $wsdl->getType($param->getType()));
       
   431             }
       
   432         }
       
   433         $wsdl->addMessage($function->getName() . 'In', $args);
       
   434 
       
   435         $isOneWayMessage = false;
       
   436         if($prototype->getReturnType() == "void") {
       
   437             $isOneWayMessage = true;
       
   438         }
       
   439 
       
   440         if($isOneWayMessage == false) {
       
   441             // Add the output message (return value)
       
   442             $args = array();
       
   443             if ($this->_bindingStyle['style'] == 'document') {
       
   444                 // Document style: wrap the return value in a sequence element
       
   445                 $sequence = array();
       
   446                 if ($prototype->getReturnType() != "void") {
       
   447                     $sequence[] = array(
       
   448                         'name' => $function->getName() . 'Result',
       
   449                         'type' => $wsdl->getType($prototype->getReturnType())
       
   450                     );
       
   451                 }
       
   452                 $element = array(
       
   453                     'name' => $function->getName() . 'Response',
       
   454                     'sequence' => $sequence
       
   455                 );
       
   456                 // Add the wrapper element part, which must be named 'parameters'
       
   457                 $args['parameters'] = array('element' => $wsdl->addElement($element));
       
   458             } else if ($prototype->getReturnType() != "void") {
       
   459                 // RPC style: add the return value as a typed part
       
   460                 $args['return'] = array('type' => $wsdl->getType($prototype->getReturnType()));
       
   461             }
       
   462             $wsdl->addMessage($function->getName() . 'Out', $args);
       
   463         }
       
   464 
       
   465         // Add the portType operation
       
   466         if($isOneWayMessage == false) {
       
   467             $portOperation = $wsdl->addPortOperation($port, $function->getName(), 'tns:' . $function->getName() . 'In', 'tns:' . $function->getName() . 'Out');
       
   468         } else {
       
   469             $portOperation = $wsdl->addPortOperation($port, $function->getName(), 'tns:' . $function->getName() . 'In', false);
       
   470         }
       
   471         $desc = $function->getDescription();
       
   472         if (strlen($desc) > 0) {
       
   473             $wsdl->addDocumentation($portOperation, $desc);
       
   474         }
       
   475 
       
   476         // When using the RPC style, make sure the operation style includes a 'namespace' attribute (WS-I Basic Profile 1.1 R2717)
       
   477         if ($this->_bindingStyle['style'] == 'rpc' && !isset($this->_operationBodyStyle['namespace'])) {
       
   478             $this->_operationBodyStyle['namespace'] = ''.$uri;
       
   479         }
       
   480 
       
   481         // Add the binding operation
       
   482         if($isOneWayMessage == false) {
       
   483             $operation = $wsdl->addBindingOperation($binding, $function->getName(),  $this->_operationBodyStyle, $this->_operationBodyStyle);
       
   484         } else {
       
   485             $operation = $wsdl->addBindingOperation($binding, $function->getName(),  $this->_operationBodyStyle);
       
   486         }
       
   487         $wsdl->addSoapOperation($operation, $uri . '#' .$function->getName());
       
   488 
       
   489         // Add the function name to the list
       
   490         $this->_functions[] = $function->getName();
       
   491     }
       
   492 
       
   493     /**
       
   494      * Action to take when an error occurs
       
   495      *
       
   496      * @param string $fault
       
   497      * @param string|int $code
       
   498      * @throws Zend_Soap_AutoDiscover_Exception
       
   499      */
       
   500     public function fault($fault = null, $code = null)
       
   501     {
       
   502         require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   503         throw new Zend_Soap_AutoDiscover_Exception("Function has no use in AutoDiscover.");
       
   504     }
       
   505 
       
   506     /**
       
   507      * Handle the Request
       
   508      *
       
   509      * @param string $request A non-standard request - Not Used
       
   510      */
       
   511     public function handle($request = false)
       
   512     {
       
   513         if (!headers_sent()) {
       
   514             header('Content-Type: text/xml');
       
   515         }
       
   516         $this->_wsdl->dump();
       
   517     }
       
   518 
       
   519     /**
       
   520      * Proxy to WSDL dump function
       
   521      *
       
   522      * @param string $filename
       
   523      * @return boolean
       
   524      * @throws Zend_Soap_AutoDiscover_Exception
       
   525      */
       
   526     public function dump($filename)
       
   527     {
       
   528         if($this->_wsdl !== null) {
       
   529             return $this->_wsdl->dump($filename);
       
   530         } else {
       
   531             /**
       
   532              * @see Zend_Soap_AutoDiscover_Exception
       
   533              */
       
   534             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   535             throw new Zend_Soap_AutoDiscover_Exception("Cannot dump autodiscovered contents, WSDL file has not been generated yet.");
       
   536         }
       
   537     }
       
   538 
       
   539     /**
       
   540      * Proxy to WSDL toXml() function
       
   541      *
       
   542      * @return string
       
   543      * @throws Zend_Soap_AutoDiscover_Exception
       
   544      */
       
   545     public function toXml()
       
   546     {
       
   547         if($this->_wsdl !== null) {
       
   548             return $this->_wsdl->toXml();
       
   549         } else {
       
   550             /**
       
   551              * @see Zend_Soap_AutoDiscover_Exception
       
   552              */
       
   553             require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   554             throw new Zend_Soap_AutoDiscover_Exception("Cannot return autodiscovered contents, WSDL file has not been generated yet.");
       
   555         }
       
   556     }
       
   557 
       
   558     /**
       
   559      * Return an array of functions in the WSDL
       
   560      *
       
   561      * @return array
       
   562      */
       
   563     public function getFunctions()
       
   564     {
       
   565         return $this->_functions;
       
   566     }
       
   567 
       
   568     /**
       
   569      * Load Functions
       
   570      *
       
   571      * @param unknown_type $definition
       
   572      * @throws Zend_Soap_AutoDiscover_Exception
       
   573      */
       
   574     public function loadFunctions($definition)
       
   575     {
       
   576         require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   577         throw new Zend_Soap_AutoDiscover_Exception("Function has no use in AutoDiscover.");
       
   578     }
       
   579 
       
   580     /**
       
   581      * Set Persistance
       
   582      *
       
   583      * @param int $mode
       
   584      * @throws Zend_Soap_AutoDiscover_Exception
       
   585      */
       
   586     public function setPersistence($mode)
       
   587     {
       
   588         require_once "Zend/Soap/AutoDiscover/Exception.php";
       
   589         throw new Zend_Soap_AutoDiscover_Exception("Function has no use in AutoDiscover.");
       
   590     }
       
   591 
       
   592     /**
       
   593      * Returns an XSD Type for the given PHP type
       
   594      *
       
   595      * @param string $type PHP Type to get the XSD type for
       
   596      * @return string
       
   597      */
       
   598     public function getType($type)
       
   599     {
       
   600         if (!($this->_wsdl instanceof Zend_Soap_Wsdl)) {
       
   601             /** @todo Exception throwing may be more correct */
       
   602 
       
   603             // WSDL is not defined yet, so we can't recognize type in context of current service
       
   604             return '';
       
   605         } else {
       
   606             return $this->_wsdl->getType($type);
       
   607         }
       
   608     }
       
   609 }