我正在尝试使用以下WSDL描述的SOAP Web服务: http://qaws.ssichilexpress.cl/TarificarCourier?wsdl
我试过了:
public function __construct($config) {
$this->config = $config;
$this->client = new SoapClient($this->wsdl, [
'trace' => true,
'exceptions' => true
]);
}
public function tarifar($data) {
try {
$this->client->TarificarCourier([
'reqValorizarCourier' => $data
]);
} catch(SoapFault $fault) {
die($fault->getCode() . ': ' . $fault->getMessage());
}
}
但是我收到了一条消息“无法连接到主机”的SoapFault。 有什么想法吗?
编辑1:
我也试过了:
public function __construct($config) {
$this->config = $config;
$this->wsdl = null;
$this->client = new SoapClient($this->wsdl, [
'trace' => true,
'exceptions' => true,
'location' => 'http://qaws.ssichilexpress.cl/',
'uri' => 'TarificarCourier'
]);
}
public function tarifar($data) {
try {
$this->client->__soapCall('TarificarCourier', [
'reqValorizarCourier' => $data
]);
} catch(SoapFault $fault) {
die('SFinReq: ' . $fault->getCode() . ': ' . $fault->getMessage());
}
}
但是,我得到一个带有“未找到”消息的SoapFault。