0

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

请任何人帮助我我的代码中有什么问题。谢谢。

4

1 回答 1

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, ';
}

}
 ?>
于 2015-03-30T05:19:57.640 回答