简体   繁体   English

PHP SOAP客户端。 HTTPS无法连接

[英]PHP SOAP Client. HTTPS cannot connect

Cannot for the life of my to get this SOAP client working. 我一生无法使该SOAP客户端正常工作。 Works fine on My friends box and I've compared the php.ini's and cannot see anything relating to SOAP settings. 在“我的朋友”框中可以正常工作,并且我已经比较了php.ini,并且看不到与SOAP设置有关的任何内容。 I'm running latest PHP and UBuntu 12.10. 我正在运行最新的PHP和UBuntu 12.10。

Here is my code: 这是我的代码:

$url = "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl";
$options["connection_timeout"] = 1000;
$options["location"] = $url;
$options['trace'] = 1;


try {
$client = new SoapClient("orange.xml",$options);

print_r($client->__getFunctions());



$client->peekMessages(
    'user',
    'pass',
    10
);

var_dump($client);
} catch (Exception $e) {
    echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
    echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
    echo "RESPONSE HEADERS:\n" . $client->__getLastResponseHeaders() . "\n";
    echo "Response:\n" . $client->__getLastResponse() . "\n";
    echo "Exception: \n" . $e->getMessage() . "\n";
    echo "Trace: \n" . $e->getTraceAsString() . "\n";
}

I had to save the WSDL as a file otherwise I receive a different error! 我必须将WSDL保存为文件,否则会收到其他错误!

Here is the code running: 这是运行的代码:

Array
(
    [0] => int sendMessage(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer)
    [1] => ArrayOf_xsd_string getDeliveryReports(string $username, string $password, string $deviceMSISDN, string $countryCode)
    [2] => ArrayOf_xsd_string readMessages(string $username, string $password, int $count, string $deviceMsisdn, string $countryCode)
    [3] => boolean flushMessages(string $username, string $password, string $deviceMSISDN, string $countryCode)
    [4] => ArrayOf_xsd_string waitForMessage(string $username, string $password, int $timeout, string $deviceMSISDN, int $msgref, string $countryCode)
    [5] => int sendMessageWithValidityPeriod(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs, string $validityDaysHoursMins)
    [6] => int sendBinarySmsMessage(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs)
    [7] => ArrayOf_xsd_string sendAndWait(string $username, string $password, int $timeout, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer)
    [8] => ArrayOf_xsd_string sendBinarySmsAndWait(string $username, string $password, int $timeout, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs)
    [9] => ArrayOf_xsd_string peekMessages(string $username, string $password, int $count, string $deviceMsisdn, string $countryCode)
    [10] => ArrayOf_xsd_string getDeliveryReportsFromDate(string $username, string $password, string $deviceMSISDN, string $countryCode, string $fromDate)
)
REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soap.otel.telematics.orange.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:peekMessages><username xsi:type="xsd:string">username</username><password xsi:type="xsd:string">password</password><count xsi:type="xsd:int">10</count><deviceMsisdn xsi:nil="true"/><countryCode xsi:nil="true"/></ns1:peekMessages></SOAP-ENV:Body></SOAP-ENV:Envelope>

REQUEST HEADERS:

RESPONSE HEADERS:

RESPONSE:

EXCEPTION: 
Could not connect to host
Trace: 
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://m2mconn...', '', 1, 0)
#1 /var/www/soap-app.com/Zend/public/soap.php(34): SoapClient->__call('peekMessages', Array)
#2 /var/www/soap-app.com/Zend/public/soap.php(34): SoapClient->peekMessages('username', 'password', 10)
#3 {main}

My username & password are correct. 我的用户名和密码正确。 I believe it has something to do with SSL. 我相信这与SSL有关。 Here are my SOAP and SSL php.ini settings: 这是我的SOAP和SSL php.ini设置:

soap
Soap Client     enabled
Soap Server     enabled 

Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls

curl    SSL     Yes 

openssl
OpenSSL support             enabled
OpenSSL Library Version     OpenSSL 1.0.1c 10 May 2012
OpenSSL Header Version      OpenSSL 1.0.1c 10 May 2012 
SSL Version                 OpenSSL/1.0.1c 

Any help would be great. 任何帮助都会很棒。 Pulling my hair out! 拉我的头发!

More details: 更多细节:

Running: 正在运行:

echo file_get_contents('https://m2mconnect.orange.co.uk/orange-soap/services/Message‌​ServiceByCountry?wsdl');

Results in: 结果是:

Warning: file_get_contents(): Failed to enable crypto.

Edit: 编辑:

Seems these bug tickets are relevant: https://bugs.php.net/bug.php?id=52106 这些错误通知单似乎相关: https : //bugs.php.net/bug.php?id=52106

However I'm using latest PHP version, and I need to as I am using Zend Framework 2. 但是,我使用的是最新的PHP版本,因此需要使用Zend Framework 2。

https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl

Does not appear to load, same with just http:// 似乎未加载,与http://相同

If you say you can get to it then this shouldn't be a problem. 如果您说可以,那么这应该不是问题。 However, if you need more help, then I suggest you make it so that we can access the URL. 但是,如果您需要更多帮助,那么建议您这样做,以便我们可以访问URL。 Then we can give it the proper testing and better solutions. 然后,我们可以为其提供适当的测试和更好的解决方案。

It seems that all this was because of my network settings. 似乎所有这些都是由于我的网络设置。 I was using a router with the open source firmware DD-WRT installed on it to extend my wireless network. 我正在使用安装了开源固件DD-WRT的路由器来扩展我的无线网络。 When I took that router out of the network the connection succeeds. 当我将该路由器从网络中取出时,连接成功。 Took me a week to solve this! 花了我一周的时间来解决这个问题!

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

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