Skip to content

在ZF2使用Soap调用Web Service

Published: at 00:00
代码
public function testAction() {
    try {
        $client = new \Zend\Soap\Client();

        $client->setWSDL('http://127.0.0.1/test/ws/query/event/detail?wsdl');
        $client->setSoapVersion(SOAP_1_1);
        $result = $client->run("ssdsds");
        var_dump($result);
        exit;
    } catch (\SoapFault $sf) {
        echo 'Error: [', $sf->getCode(), '] ', $sf->getMessage() ;
    } catch (\Exception $ex) {
        echo 'Exception: [', $ex->getCode(), '] ', $ex->getMessage();
    }
    exit;
}