Codeigniter Nusoap错误

时间:2012-08-11 08:46:38

标签: codeigniter nusoap

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

<?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);
    }
?>

请有人帮我解决我的代码中的问题。感谢。

1 个答案:

答案 0 :(得分: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, ';
}

}
 ?>