未捕获的 SoapFault 异常:[HTTP] 获取 http 标头时出错

2022-08-30 16:25:26

我正在尝试创建与Magento的Web服务的肥皂连接,但是当我尝试创建肥皂客户端类的实例时,我遇到了错误。我可以在firefox中毫无问题地查看wsdl文件,并且我可以看到php在apaches日志中对wsdl发出请求,但它仍然失败了。Nusoap可以连接。

$proxy = new SoapClient('someaddress?wsdl');

错误是

<b>Fatal error</b>:  Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /home/sites/xxx/xxx_main/system/application/views/contentpage_templates/gift_service.php:29
Stack trace:
[internal function]: SoapClient-&gt;__doRequest('&lt;?xml version=&quot;...',    'http://cornishw...', 'urn:Mage_Api_Mo...', 1, 0)
[internal function]: SoapClient-&gt;__call('call', Array)
/home/sites/xxx/xxx_main/system/application/views/contentpage_templates/gift_service.php(29): SoapClient-&gt;call(NULL, 'catalog_categor...', 5, 'giftshop')
/home/sites/xxx/xxx_main/system/application/libraries/MY_Loader.php(586): include('/home/sites/cor...')
/home/sites/xxx/xxx_main/system/application/libraries/MY_Loader.php(228): MY_Loader-&gt;_ci_load(Array, '')
/home/sites/xxx/xxx_main/system/application/modules/contentpage/controllers/contentpage.php(44): MY_Loader-&gt;view('contentpage_tem...', false, true)
[internal function]: Contentpage-&gt;index()
/home/sites/xxx in <b>/home/sites/xxx/xxx_main/system/application/views/contentpage_templates/gift_service.php</b> on line <b>29</b>

谢谢


答案 1

尝试设置:

default_socket_timeout = 120

在您的文件中。php.ini


答案 2

您是否尝试过添加

'trace'=>1,

到 SoapClient 创建参数,然后:

var_dump($client->__getLastRequest());
var_dump($client->__getLastResponse());

看看发生了什么?


推荐