2

我正在尝试完成 Yii 文档中给出的设置 Web 服务的示例。此处的文档: http ://www.yiiframework.com/doc/guide/1.1/en/topics.webservice

当我尝试使用以下命令查看 WSDL 时出现以下错误http://localhost/adws/index.php/Lookup/guy

include(if.php): failed to open stream: No such file or directory

查找控制器.php

<?php
class LookupController extends Controller
{
    public function actions()
    {
        return array(
            'guy'=>array(
                'class'=>'CWebServiceAction',
            ),
        );
    }

    /**
     * @param string of person you are asking about
     * @return if the service knows them
     * @soap
     */
    public function getAuthentication($person)
    {
       return 'To hell with '.$person;
    }
}

剪辑堆栈跟踪:

    C:\Users\xampp\htdocs\framework\YiiBase.php(427): YiiBase::autoload()

422                             break;
423                         }
424                     }
425                 }
426                 else
427                     include($className.'.php');
428             }
429             else  // class name with namespace in PHP 5.3
430             {
431                 $namespace=str_replace('\\','.',ltrim($className,'\\'));
432                 if(($path=self::getPathOfAlias($namespace))!==false)

#1  
–
 C:\Users\xampp\htdocs\framework\YiiBase.php(302): YiiBase::autoload("if")

297             }
298         }
299 
300         if(($pos=strrpos($alias,'.'))===false)  // a simple class name
301         {
302             if($forceInclude && self::autoload($alias))
303                 self::$_imports[$alias]=$alias;
304             return $alias;
305         }
306 
307         $className=(string)substr($alias,$pos+1);

#2  
–
 C:\Users\xampp\htdocs\framework\web\services\CWsdlGenerator.php(287): YiiBase::import("if", true)

282             $this->processType($type);
283             return $this->types[$type.'[]'];
284         }
285         else
286         {    // process class / complex type
287             $type=Yii::import($type,true);
288             $class=new ReflectionClass($type);
289 
290             $comment=$class->getDocComment();
291             $comment=strtr($comment,array("\r\n"=>"\n","\r"=>"\n")); // make line endings consistent: win -> unix, mac -> unix
292             $comment=preg_replace('/^\s*\**(\s*?$|\s*)/m','',$comment);

#3  
–
 C:\Users\xampp\htdocs\framework\web\services\CWsdlGenerator.php(257): CWsdlGenerator->processType("if")

252             $message[$params[$i]->getName()]=array($this->processType($matches[1][$i]), trim($matches[3][$i])); // name => type, doc
253 
254         $this->messages[$methodName.'Request']=$message;
255 
256         if(preg_match('/^@return\s+([\w\.]+(\[\s*\])?)\s*?(.*)$/im',$comment,$matches))
257             $return=array($this->processType($matches[1]),trim($matches[2])); // type, doc
258         else
259             $return=null;
260         $this->messages[$methodName.'Response']=array('return'=>$return);
261 
262         if(preg_match('/^\/\*+\s*([^@]*?)\n@/s',$comment,$matches))

#4  
–
 C:\Users\xampp\htdocs\framework\web\services\CWsdlGenerator.php(223): CWsdlGenerator->processMethod(ReflectionMethod)

218 
219         $reflection=new ReflectionClass($className);
220         foreach($reflection->getMethods() as $method)
221         {
222             if($method->isPublic())
223                 $this->processMethod($method);
224         }
225 
226         $wsdl=$this->buildDOM($serviceUrl,$encoding)->saveXML();
227 
228         if(isset($_GET['makedoc']))

#5  
–
 C:\Users\xampp\htdocs\framework\web\services\CWebService.php(151): CWsdlGenerator->generateWsdl("LookupController", "http://localhost/adws/index.php/lookup/guy?ws=1", "UTF-8")

146             $key='Yii.CWebService.'.$providerClass.$this->serviceUrl.$this->encoding;
147             if(($wsdl=$cache->get($key))!==false)
148                 return $wsdl;
149         }
150         $generator=Yii::createComponent($this->generatorConfig);
151         $wsdl=$generator->generateWsdl($providerClass,$this->serviceUrl,$this->encoding);
152         if(isset($key))
153             $cache->set($key,$wsdl,$this->wsdlCacheDuration);
154         return $wsdl;
155     }
4

0 回答 0