title: SOAP Client over HTTPS with SSL certificates on both sides
body: <p>I have to develop a SOAP Client, and the supplier send me this specifications:</p>
  
  <ul>
  <li><em>Will be transmited using HTTPS through IP, and will be Packaged as XML documents that adjust to the diferent defnitions of XML scheme.</em></li>
  <li><em>The Communications is synchronous, the third party should wait for response.</em></li>
  <li><em>Each request and response will be signed.</em></li>
  </ul>
  
  <p>I'm using the soapClient class from PHP, and all works fine, except when I try to use my private key to establish communication with the server:</p>
  
  <pre><code>Code: WSDL | Message: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://remoteserver/CustomerManagementService?wsdl' : failed to load external entity "https://remoteserver/CustomerManagementService?wsdl
  </code></pre>
  
  <p>Then I tried creating a .pem file, it contains my private key concatenated with my certificate, as I've read in: <a href="https://stackoverflow.com/questions/11676392/how-to-send-soap-request-with-ssl-certificate-in-php">how to send SOAP request with SSL certificate in PHP?</a></p>
  
  <p>But it still returns an error:</p>
  
  <pre><code>SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://remoteserver:80/CustomerManager/proxy/CustomerManagementService?WSDL%2FGWTCommonResources%2Fwsdl%2FGWTCommonMessages' : failed to load external entity "http://remoteserver:80/CustomerManager/proxy/CustomerManagementService?WSDL%2FGWTCommonResources%2Fwsdl%2FGWTCommonMessages
  </code></pre>
  
  <p>I wonder if there is some way to get exactly the raw data that is being sent by the soapClient class of PHP. And where I must set the certificate of the supplier.</p>
  
  <p>I've already tried with "$client->__getLastRequest()", but I'm getting a NULL. This is my code:</p>
  
  <pre><code>$client = new anotherSoapClient($service, array(
      'local_cert'    =&gt; $pem, 
      'style'         =&gt; SOAP_RPC,
      'use'           =&gt; SOAP_ENCODED,
      'soap_version'  =&gt; SOAP_1_2,
      'authentication'=&gt; SOAP_AUTHENTICATION_DIGEST,
      'ssl'           =&gt; array(
          'ciphers'=&gt; "SHA1",
          'verify_peer' =&gt; false, 
          'allow_self_signed' =&gt; true
      ),
      'https' =&gt; array(
          'curl_verify_ssl_peer'  =&gt; false,
          'curl_verify_ssl_host'  =&gt; false
      ),
      'cache_wsdl'    =&gt; WSDL_CACHE_NONE,
      'cache_ttl'     =&gt; 86400,
      'trace'         =&gt; true,
      'exceptions'    =&gt; true,
  ));
  
  // Test connection
  echo BR.'Functions: &lt;pre&gt;';var_dump($client-&gt;__getFunctions());echo '&lt;/pre&gt;';
  
  $XMLrequest = $client-&gt;prepareRequest($email);
  $response = $client-&gt;__anotherRequest('getCustomerInfo', $XMLrequest);
  
  echo "REQUEST:\n" . $client-&gt;__getLastRequest() . "\n";
  </code></pre>
  
  <p>By the way, I'm using PHP 5.4.9 on my local machine and the server have PHP 5.3.10 and anotherSoapClient is a class who extend PHP soapClient class: <a href="https://stackoverflow.com/questions/19009554/php-soapclient-send-custom-xml">PHP soapClient send custom XML</a></p>