Jump to content

How to make a SOAP call with certificates


guarriman

Recommended Posts

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: http://lab.webservice.com/IsValidUser" \
  -v \
  -G \
  --key key.pem \
  --cert verisign.crt \
  https://lab.webservice.com/UsersService.asmx

 

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?

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.