2

我目前正在尝试使用 Zend SOAP Client 使用 SOAP Web 服务,但我目前面临无法访问任何方法的问题,因为 post 绑定位置地址与我正在访问的 url 不同WSDL 来自。

我已经在 SO 上发现了这个类似的问题:

wsdl 将服务端口绑定定义为 https 和端口 80 时 PHP SOAP 请求失败的解决方法?

但是OP在这里问的评论

wsdl 将服务端口绑定定义为 https 和端口 80 时 PHP SOAP 请求失败的解决方法?

是我目前正在寻找的答案。

这是我当前调用 WSDL 时遇到的错误

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxxx.xxx.xx:9076/inventory?wsdl=InventoryWSSoap.wsdl' : failed to load external entity "http://xxxx.xxx.xx:9076/inventory?wsdl=InventoryWSSoap.wsdl"

这是我的代码

<?php
require_once "vendor/autoload.php";

$apiUrl = "https://testurl.com/inventory?wsdl";

try {
    $client = new Zend\Soap\Client($apiUrl, array(
        'compression' => SOAP_COMPRESSION_ACCEPT,
        'proxy_port' => 9076,
    ));

    $params = array(
        'name' => 'usnema',
        'pwd' => 'xxxxx',
        'operatorId' => '11210210'
    );
    $adSpace = $client->GetAdSpaceList($params);

    echo "<pre>";
    var_dump($adSpace);
} catch (Exception $e) {
    echo $e->getMessage();
}
4

0 回答 0