Forum Moderators: coopster

Message Too Old, No Replies

How to make a SOAP call with certificates

         

guarriman

5:31 pm on Mar 11, 2008 (gmt 0)

10+ Year Member



Hi.

I'd like to "translate" this cURL call (which works ok) to PHP SOAP:

----------
curl \
--data @file.xml \
--header "Content-Type: text/xml; charset=utf-8" \
--header "SOAPAction: [lab.webservice.com...] \
-v \
-G \
--key key.pem \
--cert verisign.crt \
[lab.webservice.com...]
----------

Contents of "file.xml":
----------
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IsValidUser xmlns="http://lab.webservice.com/">
<userId>555</userId>
<lastName>Smith</lastName>
</IsValidUser>
</soap:Body>
</soap:Envelope>
--------

I don't know how to implement it with:
----
$wsdl = 'https://lab.webservice.com/UsersService.asmx';
$client = new SOAPClient($wsdl);

$params = array(
'userId' => '555',
'lastName' => 'Smith'
);

$response = $client->__call(....
---------

Any suggestion?

guarriman

6:27 pm on Mar 11, 2008 (gmt 0)

10+ Year Member



I tried with:
 
$wsdl = 'https://lab.domain.com/UserService.asmx';
$local_cert = 'key-cert.pem';
$passphrase = 'foofoo';

$client = new SoapClient($wsdl, array('trace'=>true, 'exceptions'=>true, 'local_cert' => $local_cert, 'passphrase' => $passphrase));

but I get this error message:

 
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://lab.domain.com/UserService.asmx' in /home/code/soap4.php on line 7