yiiapi/tests/framework/web/controllers/SoapController.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
* Fake SOAP controller for unit tests
* Handle SOAP client requests & generate WSDL.
* 
* NOTE:
* This is a fake controller used only for generating WSDL files.
* Some functionlities are here as an example and may not be fully functional.
* 
* Sample call:
*   $client = new SoapClient('http://1.2.3.4/index.php?r=soap');
* 	$response = $client->connect();
*/
class SoapController extends CController implements IWebServiceProvider
{
	const LOGNAME = 'soap';
	
	public function actions(){
        return array(
        	// remap default action "index" to be a SOAP action
            'index'=>array(
                'class'=>'WebServiceAction',
                'classMap' => array(
                	'SoapPovCalculationInput', 'SoapPovCalculationOutput',
                ),
            ),
        );
    }

    /**
    * Preprocess actions before calling SOAP action.
    * This method must implement interface's abstract method.
    * @param mixed $service
    */
	public function beforeWebMethod($service) {
		// do whatever stuff before executing the action ...
		return true;
	}
    
    /**
    * Postprocess actions after SOAP action executed.
    * This method must implement interface's abstract method.
    * @param mixed $service
    */
    public function afterWebMethod($service) {
		// do whatever stuff after executing the action ...
    	return true;
	}
	
    /**
    * Return TRUE if the SOAP user is authorized.
    */
    protected function isAuthorized($user, $passwordHashed, $action) {
    	// load allowed users..
    	$users = array('tester123' => 'passwordHashed123');

    	if (isset($users[$user]) && $passwordHashed == $users[$user]) {
   			/**
    		* @var CHttpRequest
    		*/
后面还有 45 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。