2012-07-25 117 views
0

一個早上的Google搜索我學到了一些東西。 許多人希望使用他們的CI2安裝來製作肥皂服務器,讓其他應用程序與他們的應用程序交談。 但是,我發現的每個論壇帖子都以'這在CI2中不起作用「或類似的結尾。codeigniter2,nusoap,肥皂服務器和示例

我發現這篇文章: http://phpmaster.com/web-services-with-php-and-soap-1/

這是偉大的......但我不能讓它在CI2工作。

我已經把我的庫放在適當位置,在需要的地方重新命名,並且這段代碼引發了很多錯誤。 我還沒有開始在客戶端。

`類肥皂擴展是CI_Controller {

function __construct() 
{ 
    parent:: __construct(); 
    $this->load->library('nusoap_base'); 
} 

function index() 
{ 
    $this->nusoap = new soap_server(); 
    $this->nusoap->register("getProd"); 
    $this->nusoap->service($HTTP_RAW_POST_DATA); 
} 

function getProd($category) { 
    if ($category == "books") { 
     return join(",", array(
      "The WordPress Anthology", 
      "PHP Master: Write Cutting Edge Code", 
      "Build Your Own Website the Right Way")); 
    } 
    else { 
      return "No products listed under that category"; 
    } 
} 

}`

回答

0

厭倦了,使用CI REST庫,而不是(歡呼菲爾!) :)