2012-08-11 88 views
0

我是Codeigniter和SOAP Web服务的新手。我收到了我下面的错误回复。Codeigniter Nusoap错误

<?php 
class Webservice extends CI_Controller { 

    var $ns = "http://localhost/website/webservice"; 

    public function __construct() 
    { 
     parent::__construct(); 
     $this->load->library("Nusoap_lib"); 

     $this->server = new soap_server(); 
     // Initialize WSDL support 
     $this->server->configureWSDL('hellowsdl', 'urn:hellowsdl'); 
     // Register the method to expose 
     $this->server->register('hello'); 


     // Define the method as a PHP function 
    } 

    public function hello() { 
     return 'Hello, '; 
    } 

    function index() 
    { 
     $this->server->service($this->ns); 
    } 
?> 

请有人帮我在我的代码中有什么问题。谢谢。

+0

什么是错误响应? – 2012-08-11 08:47:58

+0

我已经使用Firefox SOA客户端,我得到:“获取响应错误”消息。 – 2012-08-11 08:53:31

回答

0

在index()函数内声明hello函数,它为我工作。但是声明出index()函数给了我一个问题。

<?php 
class Webservice extends CI_Controller { 

var $ns = "http://localhost/website/webservice"; 

public function __construct() 
{ 
    parent::__construct(); 
    $this->load->library("Nusoap_lib"); 

    $this->server = new soap_server(); 
    // Initialize WSDL support 
    $this->server->configureWSDL('hellowsdl', 'urn:hellowsdl'); 
    // Register the method to expose 
    $this->server->register('hello'); 


    // Define the method as a PHP function 
} 

function index() 
{ 
    $this->server->service($this->ns); 
     public function hello() { 
    return 'Hello, '; 
} 

} 
?>