ID: 36104
Updated by: sniper@php.net
Reported By: marcin dot dabrowski at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: SOAP related
Operating System: Windows XP [Version 5.1.2600]
PHP Version: 5.1.2
-Assigned To:
+Assigned To: dmitry
New Comment:
Assigned to the maintainer.
Previous Comments:
------------------------------------------------------------------------
[2006-01-20 15:59:12] marcin dot dabrowski at gmail dot com
Description:
------------
I'm trying to use SoapClient with certificate. When I set the cert file
path using options array I have 'Could not connect to host' error, while
setting the path as a property works like a charm.
I tried to see whats with the connection, and (using netcat: nc -vvnLp
433) I got the following results.
- with 'php test.php 1' netcat gives:
listening on [127.0.0.1] 443 ...
connect to [127.0.0.1] from (UNKNOWN) [127.0.0.1] 2055
sent 0, rcvd 0
- with 'php test.php 0' netcat gives:
listening on [127.0.0.1] 443 ...
connect to [127.0.0.1] from (UNKNOWN) [127.0.0.1] 2056
[binary stuff, SSL Handshake I think]
sent 0, rcvd 132
PS: I tried with
http://snaps.php.net/win32/php5.1-win32-200601201130.zip,
same results.
Reproduce code:
---------------
<?php
$optionsInArray = (bool)$argv[1];
if ($optionsInArray) {
$opts = array(
'ssl' => array(
'local_cert' => './cli_crt.pem',
'allow_self_signed' => true
)
);
$ctx = stream_context_create($opts);
$soap = new SoapClient('a.wsdl', array(
'stream_context' => $ctx,
'local_cert' => './cli_crt.pem'
));
} else {
$soap = new SoapClient('a.wsdl');
$soap->_local_cert = './cli_crt.pem';
}
try {
var_export($soap->greet('Frodo'));
} catch (SoapFault $e) {
var_export($e);
}
?>
Expected result:
----------------
Both ways this script should produce successful connection, and
actually invoke the WebService. Only the second way it works as it
should.
Actual result:
--------------
C:\usr\home\www\ws>php test.php 0
'Hello, World, and Frodo!!!'
C:\usr\home\www\ws>php test.php 1
SoapFault::__set_state(array(
'message' => '',
'string' => '',
'code' => 0,
'file' => 'C:\\usr\\home\\www\\ws\\test.php',
'line' => 21,
'trace' =>
array (
0 =>
array (
'function' => '__doRequest',
'class' => 'SoapClient',
'type' => '->',
'args' =>
array (
0 => '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:Hellowsdl" xmlns:xsd="http://w
http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyl
coding/"><SOAP-ENV:Body><ns1:greet><person
xsi:type="xsd:string">Frodo</person></ns1:greet></SOAP-ENV:Body></SOAP-ENV:Envel
',
1 => 'https://localhost/ws/index.php?realm=Hello',
2 => 'urn:Hellowsdl#greet',
3 => 1,
),
),
1 =>
array (
'function' => '__call',
'class' => 'SoapClient',
'type' => '->',
'args' =>
array (
0 => 'greet',
1 =>
array (
0 => 'Frodo',
),
),
),
2 =>
array (
'file' => 'C:\\usr\\home\\www\\ws\\test.php',
'line' => 21,
'function' => 'greet',
'class' => 'SoapClient',
'type' => '->',
'args' =>
array (
0 => 'Frodo',
),
),
),
'faultstring' => 'Could not connect to host',
'faultcode' => 'HTTP',
))
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36104&edit=1