2012-07-20 60 views
0

我正在使用WAMP & CakePHP,並嘗試添加一個NuSOAP服務器。我可以通過生成一個的NuSOAP WSDL的動態,但在正在通過的NuSOAP設置底部的參數,並沒有任何意義:PHP/NuSOAP設置肥皂:地址位置

<soap:address location="http://localhost/cakephp/app/webroot/index.php"/> 

正確的路線是:

<soap:address location="http://localhost/cakephp/web_service/web_service"/> 

我無法弄清楚如何改變這一點,或者甚至NuSOAP正在拿起那個位置(我在代碼中完全沒有提及它)。

這是我的代碼,我使用:

class WebServiceController extends AppController { 
     var $components = array('RequestHandler'); 
     public function web_service() 
     { 
      $this->layout = FALSE; 
      $this->autoRender = FALSE; 
      Configure::write('debug', 0); 
      $this->RequestHandler->respondAs('xml'); 
      App::import('Vendor', 'nusoap', array('file' => 'nusoap'.DS.'lib'.DS.'nusoap.php')); 
      include 'local_functions.php'; 
      if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA =file_get_contents('php://input'); 


      $server = new soap_server(); 
      $namespace = "http://localhost/web_service/web_service"; 
      $server->configureWSDL("web-service", $namespace);//, "urn:web-service"); 
      $server->wsdl->schemaTargetNamespace = $namespace; 
      include 'wsdl_types.php'; 
      $server->register("Subscribe", array("accessKey" => "xsd:string","publisher" => "xsd:string","subscribeData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#Subscribe", "rpc", "encoded", "Subscribe to mail or mobile list(s)"); 
      $server->register("SendEmailFromWeb", array("accessKey" => "xsd:string","publisher" => "xsd:string","sendEmailFromWebData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#SendEmailFromWeb", "rpc", "encoded", "Send email from web interface"); 
      $server->register("SendEmailFromMobile", array("accessKey" => "xsd:string","publisher" => "xsd:string","sendEmailFromMobileData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#SendEmailFromMobile", "rpc", "encoded", "Send email from mobile interface"); 
      $server->register("UpdateProfile", array("accessKey" => "xsd:string","publisher" => "xsd:string","updateProfileData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#UpdateProfile", "rpc", "encoded", "Update subscriber profile (name, etc.)"); 
      $server->register("Unsubscribe", array("accessKey" => "xsd:string","publisher" => "xsd:string","unsubscribeData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#Unsubscribe", "rpc", "encoded", "Unsubscribe from mail or mobile list(s)"); 
      $server->register("SMSTriggeredEmailNotify", array("accessKey" => "xsd:string","publisher" => "xsd:string","smsTriggeredEmailNotifyData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#SMSTriggeredEmailNotify", "rpc", "encoded", "Still working on this"); 
      $server->service($HTTP_RAW_POST_DATA); 


     } 
    } 

回答

8

我找到了答案:

$server->configureWSDL("web-service", $namespace); 

應該是:

$endpoint = "http://localhost/web_service/web_service"; 
$server->configureWSDL("web-service", $namespace, $endpoint); 
+0

你是怎麼寫的函數 「訂閱」 。我有一些cakephp的問題。就像「msg解析中的錯誤:xml是空的,沒有解析!」。如何避免這一點。在正常的PHP它工作正常 – 2013-09-13 05:54:04