简体   繁体   English

SOAP:致命错误..无法连接到主机

[英]SOAP: Fatal Error .. Could not connect to host

I've tried everything I can think of to no avail, and hope you can help. 我已经尝试了所有我能想到的一切,但希望您能提供帮助。

I've taken on a site from another web dev, so am working on existing code. 我从另一个Web开发人员那里访问了一个站点,因此正在研究现有代码。

The code works on my own development server (debian VM on my Win7 machine), but not on the live server (WHM/cPanel admin'd REDHAT Enterprise 5.4 x86_64 standard). 该代码可在我自己的开发服务器(Win7计算机上的Debian VM)上运行,但不能在实时服务器(WHM / cPanel管理员使用REDHAT Enterprise 5.4 x86_64标准)上运行。

I get the following error after the call to $BHclient->startSession : 调用$BHclient->startSession之后,出现以下错误:

Fatal error:  Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/aap3r/public_html/soap_test.php:60
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://api.bul...', '', 1, 0)
#1 /home/aap3r/public_html/soap_test.php(60): SoapClient->__call('startSession', Array)
#2 /home/aap3r/public_html/soap_test.php(60): SoapClient->startSession(Object(stdClass))
#3 {main}
  thrown in /home/aap3r/public_html/soap_test.php on line 60

The WDSL file is downloaded okay (though it appears to have the wrong mime-type). 可以下载WDSL文件(尽管它似乎具有错误的mime类型)。

Since the exact same test code works on one server but not another I thought it was a firewall issue, but the host denies it. 由于完全相同的测试代码可以在一台服务器上运行,而不能在另一台服务器上运行,所以我认为这是防火墙问题,但是主机拒绝了。

The relevant code: 相关代码:

$url = "http://api.bullhornstaffing.com/webservices-2.0/?wsdl";

ini_set('soap.wsdl_cache_enabled',1);
ini_set('soap.wsdl_cache_ttl',1);

$username = "xxx";
$password = "xxx";
$apiKey = "xxxx";

$session_request = new stdClass();
$session_request->username = $username;
$session_request->password = $password;
$session_request->apiKey = $apiKey;

$BHclient = new SoapClient($url, array("trace" => true, "exception" => false));

$API_session = $BHclient->startSession($session_request);

print_r($API_session);

phpinfo confirms that SOAP is installed, and I've tried the various implementation/installation methods presented in the control panels. phpinfo确认已安装SOAP,并且我尝试了控制面板中介绍的各种实现/安装方法。

I've updated to PHP Version 5.3.27 and Apache to 2.2.25. 我已经更新到PHP版本5.3.27,将Apache更新到2.2.25。

Any help will be hugely appreciated. 任何帮助将不胜感激。


Update: I've found a workaround. 更新:我找到了一种解决方法。 For whatever reason the production server couldn't connect to HTTP*S*, so I copied and rehosted the WDSL file after manually editing it to replace the protocol. 无论出于什么原因,生产服务器都无法连接到HTTP * S *,因此在手动编辑WDSL文件以替换协议之后,我复制并重新托管了WDSL文件。

I would record the network traffic with tcpdump : 我会用tcpdump记录网络流量:

tcpdump -s65535 -iYOUR_INTERFACE -w soap.pcap 

You can analyze the traffic ( soap.pcap ) using wireshark . 您可以使用wireshark分析流量( soap.pcap )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM