title: how to send SOAP request with SSL certificate in PHP?
body: <p>I'm trying to send a SOAP - PHP request with a DER certificate (that means the certificate don't have a privateKey) but no success.</p>
  
  <pre><code>$local_cert = FULL_PATH_TO_MY_CERT;
  
     $client = new SoapClient($wsdl, array(
                  'local_cert' =&gt; $local_cert,
                  'trace' =&gt; 1,
                  'exceptions' =&gt; 1,
                  'soap_version' =&gt; SOAP_1_1,
                  'encoding' =&gt; 'ISO-8859-1',
                  'compression' =&gt; (SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP),
                  'location' =&gt; 'https://webserviceurl:port/ws/servlet/ws'
              ));
  </code></pre>
  
  <p>Only I recieve this errors:</p>
  
  <p>Warning (2): SoapClient::SoapClient() [soapclient.soapclient]: Unable to set private key file `PATHTOMYLOCALCERT' [APP\Vendor\WebServices\MyWS.php, line 206]</p>
  
  <p>Warning (2): SoapClient::SoapClient() [soapclient.soapclient]: failed to create an SSL handle [APP\Vendor\WebServices\MyWS.php, line 206]</p>
  
  <p>Warning (2): SoapClient::SoapClient() [soapclient.soapclient]: Failed to enable crypto [APP\Vendor\WebServices\MyWS.php, line 206]</p>
  
  <p>Warning (2): SoapClient::SoapClient(https://webserviceurl:port/ws/servlet/ws?wsdl) [soapclient.soapclient]: failed to open stream: operation failed [APP\Vendor\WebServices\MyWS.php, line 206]</p>
  
  <p>Warning (2): SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "https://webserviceurl:port/ws/servlet/ws?wsdl" [APP\Vendor\WebServices\MyWS.php, line 206]</p>
  
  <p>but I've found a little trick (in php.net) using the function file_get_contents($local_cert); the errors are gone.</p>
  
  <p>But a new error come from.</p>
  
  <p>Result : string(773) "Error reading prefix:Action.Execute"</p>
  
  <p>What I mean is... this error above... is comming from the WebService? because it cannot authenticate with my request?</p>
  
  <p>Thanks everybody. (appreciate your answers)</p>