我有一個LAMP服務器(#1)通過SOAP與另一個服務器(#2)通過WSDL進行通信。如果我在服務器1的命令行上向服務器2的URL發出curl調用,它會正常工作,並獲得相應的WSDL響應,但對同一個URL的php soapclient會收到「未能加載外部實體」錯誤。當我們在服務器2上有一個自簽名證書時,這是工作的,但在我們升級到CA證書的同時退出了工作。php SoapClient無法連接,但命令行卷曲調用工作
有趣的是,這臺服務器與另一臺服務器在不同位置(不同的操作系統,但相同的PHP代碼/數據庫)的負載平衡,第二臺服務器根本沒有任何問題。
這裏是我使用的SOAP客戶端代碼:
function getSoapClient(){
ini_set("soap.wsdl_cache_enabled", 0);
// standard soap client for application service
$post_url = lum_getString("[CAMPAIGN_POST_URL]").
"?enterprise=".lum_getString("[CAMPAIGN_ENTERPRISE]").
"&company=".lum_getString("[CAMPAIGN_COMPANY]");
$options = array(
'trace' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
'exceptions' => 1,
'verifypeer' => false,
'verifyhost' => false,
'allow_self_signed' => true,
'login' => lum_getString("[CAMPAIGN_POST_ID]"),
'password' => lum_getString("[CAMPAIGN_POST_LC]"),
);
$context = stream_context_create(
array(
'user_agent' => 'PHPSoapClient',
'ssl' => array(
'verify_peer' => false,
'allow_self_signed' => true,
),
'https' => array(
'curl_verify_ssl_peer' => false,
'curl_verify_ssl_host' => false,
)
)
);
$options['stream_context'] = $context;
$client = new SoapClient($post_url."&wsdl",$options);
return $client;
}
翹曲,使用相同的端口,因此它不應該是防火牆的問題SoapClient的。
任何幫助識別問題或幫助我找出什麼是錯誤的,非常感謝。
我確保openssl版本在工作負載均衡機器和損壞的客戶機服務器#1之間匹配,將破損的服務器#1降級到版本1.01,沒有任何影響。 – user3303872