2012-05-10 36 views
1

クライアントがそのメソッドを呼び出して文字列値を取得できる単純なSOAPサービスを開発する必要があります。PHP ZEND Frameworkの次のファイルがあります。 http://localhost/Zend/MyProject/library/client.php 結果は>> ID:私はMAMPを使用しています< < < は、私はそれを整理するために助けてくださいおかげ結果がありません、Webサービス

<?php 
class IndexController extends Zend_Controller_Action 
{ 

    public function init() 
    { 
     /* Initialize action controller here */ 
    } 

    public function indexAction() 
    { 

     $this->getHelper('viewRenderer')->setNoRender(true); 

      // initialize server and set URI 
      $server = new Zend_Soap_Server(null, 
      array('uri' => 'http://localhost/Zend/MyProject/public/index')); 

      // set SOAP service class 
      $server->setClass('Example_Manager'); 

     $server->setObject(new Example_Manager()); 

      // handle request 
      $server->handle(); 
      //$request = $server ->getLastRequest(); 
    } 
} 

?php 
class Example_Manager { 

    /** 
    * Returns list of all products in database 
    * 
    * @return array 
    */ 
    public function getProducts($name) 
    { 
     return “Product" .$name //should be without semicolon 
    } 

} 
?> 


<?php 
// load Zend libraries 
require_once 'Zend/Loader.php'; 
Zend_Loader::loadClass('Zend_Soap_Client'); 
try { 
// initialize SOAP client 
$options = array(
    'location' => 'http://localhost/Zend/MyProject/public/index/', 
    'uri'  => 'http://localhost/Zend/MyProject/public/index/', 
); 


    $client = new Zend_Soap_Client(null, $options); 
    $id = $client->getProducts("Here"); 
    print_r($id); 
    echo "ID:" .$id. "<<<"; 

} catch (SoapFault $s) { 
    die('ERROR: [' . $s->faultcode . '] ' . $s->faultstring); 
} catch (Exception $e) { 
    die('ERROR: ' . $e->getMessage()); 
} 
?> 
+0

この行を使います:return "Product"。$ name //はセミコロン無しでなければなりません: "Product"を返します。 –

答えて

0

、セミコロンが欠落しているIST getProductsメソッドの構文エラーがあります。あなたのsytnaxが正しいかどうかを素早く調べるには、php -l

関連する問題