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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.