我的PHP Soap请求在连接到路透社TRKD时失败。不幸的是,它只能在我的本地笔记本电脑上运行,而同样的请求在服务器上运行。
我的第一个猜测是通过Wireshark检查,但似乎在缓存WSDL文件之后,请求不会被发送到服务端点。
只有一个请求失败,授权,其余的工作在授权后正常工作。可能是什么问题?
php --version
PHP 5.3.10-1ubuntu3 with Suhosin-Patch (cli) (built: Apr 11 2012 17:25:33)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Ubuntu 12.04
更新:我重载了SoapClient :: __ doRequest方法来转储URL和请求。
__DO REQUEST
$request : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" xmlns:ns2="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1" xmlns:ns3="http://www.w3.org/2005/08/addressing"><env:Header><ns3:To>https://api.rkd.reuters.com/api/2006/05/01/TokenManagement_1.svc/Anonymous</ns3:To><ns3:Action>http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateServiceToken_1</ns3:Action></env:Header><env:Body><ns2:CreateServiceToken_Request_1><ns1:ApplicationID>BLAH</ns1:ApplicationID><ns2:Username>BLAH</ns2:Username><ns2:Password>BLAH</ns2:Password></ns2:CreateServiceToken_Request_1></env:Body></env:Envelope>
$location : https://api.rkd.reuters.com/api/TokenManagement/TokenManagement.svc/Anonymous
$action : http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateServiceToken_1
$version : 2
$one_way : 0
SoapFault exception: [HTTP] Could not connect to host in ..
查看其他stockoverflow帖子,我可以看到我安装了ssl。
php -i | grep ssl 1 ↵
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls
openssl
答案 0 :(得分:1)
尝试6小时..这对我有用: 'stream_context'=&gt; stream_context_create(array('ssl'=&gt; array('ciphers'=&gt;'RC4-SHA')))!
`$soap = new SoapClient($wsdl, array( 'login' => $login, 'password' => $password, 'exceptions' => true, 'stream_context' => stream_context_create(array('ssl' => array('ciphers'=>'RC4-SHA'))), 'trace' => true ));`
info:php.net CURLOPT_SSLVERSION要使用的SSL版本(2或3)。默认情况下,PHP会尝试自行确定,但在某些情况下,必须手动设置。
答案 1 :(得分:0)
尝试:
ini_set("soap.wsdl_cache_enabled", 0);