首先,创建一个新SoapClient对象,将URL传递给WSDL文件以及可选的选项数组。
// 使用WSDL URL创建一个新的客户端对象 $soap = new SoapClient('https://example.com/soap.wsdl', [ # This array and its values are optional 'soap_version' => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'cache_wsdl' => WSDL_CACHE_BOTH, # Helps with debugging 'trace' => TRUE, 'exceptions' => TRUE ]);
然后使用该$soap对象调用您的SOAP方法。
$result = $soap->requestData(['a', 'b', 'c']);