Domanda

Riscrivo il file client SOAP utilizzando Zend Framework.

Questo è vecchio metodo. funziona.

function getBassaService(){
    global $service;
    $h="127.0.0.1";
    $p="8000";

    if($service==null){
        $service = new SoapClient("/test/php/bassa.wsdl", array(
        "soap_version"   => SOAP_1_2,
        "trace"      => 1,
        "exceptions" => 1,
        "location" => "http://".$h.":".$p));
    }
    return $service;
}

function getAllDownloads(){
    global $service;
    $client = getService();
    try{
        $results = $client->__soapCall("list-all", array());
    }catch(SoapFault $e){
        print($e->faultstring);     
    }

    return $result;
}

Questo è il mio nuovo codice. Uso Zend_Soap_Client.

    const HOST = "127.0.0.1";       
    const PORT = "8095";

    protected $_client; 

    public function __construct()
    {           
        $this->_client = new Zend_Soap_Client(APPLICATION_PATH ."/services/bassa.wsdl",
        array(
            "soap_version" => SOAP_1_2,
            "uri" => "http://". self::HOST .":". self::PORT
            )
        );
    }

    public function getAllDownloads()
    {
        $result = $this->_client->list-all();
        return $result;
    }

Il mio server SOAP ha list-all metodo. Voglio una chiamata di sapone a quel metodo. Ma si è verificato dopo un errore. Perché il nome del metodo ha un trattino.

Notice: Undefined property: Zend_Soap_Client::$list in /home/dinuka/workspace/testzend/application/services/SoapClient.php on line 57

Fatal error: Call to undefined function all() in /home/dinuka/workspace/testzend/application/services/SoapClient.php on line 57

Come l'ho risolto. Mi aiuti per favore.

È stato utile?

Soluzione

strano. Questo dovrebbe funzionare. Potrebbe essere un bug nel framework ZF. Forse sta cercando di convertire il nome della funzione in un nome di funzione della custodia cammica con variabili.

Prova a utilizzare la funzione magica direttamente chiamando:

$this->_client->__call('list-all', array('param1' => $param1))
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top