2012-08-11 89 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, '; 
} 

} 
?>