我的SOAP Web服务功能没有返回任何内容

时间:2014-07-12 19:24:37

标签: web-services codeigniter soap wsdl

我正在使用Codeigniter并尝试编写一个肥皂网服务,如下所示: 一切看起来很好我在wsdl中得到了函数列表Ok并且可以正确调用它们,但事实是函数看起来没有被调用,因为每次我调用它们都返回null,我在 authenticateUser 中放置一个计数器我每次调用方法都检查过它,没有变化,我的问题在哪里。

class Webservice extends CI_Controller
{
        function Webservice()
        {
                parent::__construct();
                $this->ns = 'http://'.$_SERVER['HTTP_HOST'].'/webservice/';
                $this->load->library("nusoap_lib");
                $this->nusoap_server = new soap_server();
                $this->nusoap_server->configureWSDL("Iranmanesh law center web services", $this->ns);
                $this->nusoap_server->wsdl->schemaTargetNamespace = $this->ns;
                $this->nusoap_server->register('getMyTasks', array ('UserID' => "xsd:string", 'Password' => "xsd:string"), array ("return" => "xsd:integer"), "urn:SOAPServerWSDL", "urn:".$this->ns."/getMyTasks", "rpc", "encoded", "Get user`s tasks");
                $this->nusoap_server->register('updateTask', array ('UserID' => "xsd:string",'Password' => "xsd:string",'TaskID'=>'xsd:string','Description'=>'xsd:string','Status'=>'char'), array ("return" => "xsd:integer"), "urn:SOAPServerWSDL", "urn:".$this->ns."/updateTask", "rpc", "encoded", "Get user`s tasks");
                $this->nusoap_server->register('authenticateUser', array ('Username' => "xsd:string", 'Password' => "xsd:string"), array ("return" => "xsd:string"), "urn:SOAPServerWSDL", "urn:".$this->ns."/authenticateUser", "rpc", "encoded", "Authenticate users");
        }
        public function index()
        {
                function authenticateUser($Username=nuul,$Password=null)
                {
                        $this->load->model('counter_model');
                        $this->counter_model->update_page($Username);
                        $UserInfo=array(
                                'user'=>array('userID'=>1,'Username'=>'user','Name'=>'Masoud')
                        );
                        $Output='<user><userID>1</userID><Username>user</Username><Name>Masoud</Name></user>';
                        //return $UserInfo;
                        return TRUE;
                }
                function getMyTasks($UserID,$Password)
                {
                        $Tasks=array('task'=>
                                array('ID'=>'12','Title'=>'Go to court','Description'=>'Go to court in 3/3/1393 for Mr. Rezae','Date'=>'2012-02-23','Status'=>'U','Message'=>'It`s not done yet')
                        );
                        return $Tasks;
                }
                function updateTask($UserID,$Password,$TaskID,$Description=null,$Status)
                {
                        return array('Success'=>true);
                }
                $this->nusoap_server->service(file_get_contents("php://input"));
        }

}

我会非常感谢任何帮助。

0 个答案:

没有答案