我正在尝试创建与Magento的Web服务的soap连接,但是当我尝试创建soap客户端类的实例时,我遇到了错误.我可以毫无问题地在firefox中查看wsdl文件,我可以看到php在apaches日志中发出wsdl的请求,但它仍然失败.Nusoap可以连接.
$proxy = new SoapClient('someaddress?wsdl');
错误是
Fatal error: 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->__doRequest('<?xml version="...', 'http://cornishw...', 'urn:Mage_Api_Mo...', 1, 0) [internal function]: SoapClient->__call('call', Array) /home/sites/xxx/xxx_main/system/application/views/contentpage_templates/gift_service.php(29): SoapClient->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->_ci_load(Array, '') /home/sites/xxx/xxx_main/system/application/modules/contentpage/controllers/contentpage.php(44): MY_Loader->view('contentpage_tem...', false, true) [internal function]: Contentpage->index() /home/sites/xxx in /home/sites/xxx/xxx_main/system/application/views/contentpage_templates/gift_service.php on line 29
谢谢
尝试设置:
default_socket_timeout = 120
在你的php.ini
文件中.
你尝试过添加吗?
'trace'=>1,
到SoapClient创建参数然后:
var_dump($client->__getLastRequest()); var_dump($client->__getLastResponse());
看看发生了什么?
如果服务器端出现问题,则此错误可能会出现在客户端上.例如,如果SOAP服务器是具有解析错误的PHP脚本,则客户端将失败并显示此消息.
如果您控制服务器,请在托管SOAP服务器的计算机上拖动Apache error_log.在CentOS上你可以在/ var/log/httpd/error_log中找到它,所以命令是:
tail -f/var/log/httpd/error_log
现在刷新客户端并观察错误消息.将显示服务器脚本的任何PHP错误.
希望能帮助别人.