How to send SOAP request with SSL certificate in PHP?

I am trying to send a SOAP PHP request with a DER certificate (this means the certificate does not have privateKey), but without success.

$local_cert = FULL_PATH_TO_MY_CERT;

   $client = new SoapClient($wsdl, array(
                'local_cert' => $local_cert,
                'trace' => 1,
                'exceptions' => 1,
                'soap_version' => SOAP_1_1,
                'encoding' => 'ISO-8859-1',
                'compression' => (SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP),
                'location' => 'https://webserviceurl:port/ws/servlet/ws'
            ));

Only I get the following errors:

Warning (2): SoapClient :: SoapClient () [soapclient.soapclient]: Unable to install the private key file `PATHTOMYLOCALCERT '[APP \ Vendor \ WebServices \ MyWS.php, line 206]

Warning (2): SoapClient :: SoapClient () [soapclient.soapclient]: Failed to create SSL descriptor [APP \ Vendor \ WebServices \ MyWS.php, line 206]

Warning (2): SoapClient :: SoapClient () [soapclient.soapclient]: Failed to enable cryptography [APP \ Vendor \ WebServices \ MyWS.php, line 206]

(2): SoapClient:: SoapClient (https://webserviceurl: port/ws/servlet/ws? wsdl) [soapclient.soapclient]: : [APP\Vendor\WebServices\MyWS.php, 206]

(2): SoapClient:: SoapClient() [soapclient.soapclient]: -: "https://webserviceurl: port/ws/servlet/ws? wsdl" [APP\Vendor\WebServices\MyWS.php, 206]

( php.net), file_get_contents ($ local_cert); .

.

: (773) " : Action.Execute"

... ... WebService? ?

. ( )

+5
1

SSL- .

wsdl local_cert , . , .pem.

public $local_cert = "/var/www/.../webroot/cert.pem";
public $wsdl = "/var/www/.../webroot/my_wsdl.wsdl";

$this->client = new SoapClient($this->wsdl, array(
        "trace"         => 1, 
        "exceptions"    => true, 
        "local_cert"    => $this->local_cert, 
        "uri"           => "urn:xmethods-delayed-quotes",
        "style"         => SOAP_RPC,
        "use"           => SOAP_ENCODED,
        "soap_version"  => SOAP_1_2 ,
        "location"      => $this->location
    )
);

2 . RSA.

(1)-----BEGIN CERTIFICATE-----
MIIFjzCC....
....
-----END CERTIFICATE-----
(2)-----BEGIN RSA PRIVATE KEY-----
MIIEpAI....
....
ww==
-----END RSA PRIVATE KEY----

, https . .

, .

+7

All Articles