Thursday, June 26, 2014

PHP Soap Client Request with SSL Certificate


When required to consume PHP SOAP web services via HTTPS with certificate authentication, we pass our certificate file to the parameter, “local_cert” of the soap client class. In case our certificate and private key are in separate files, we must combine them into one file for this to work.  You can google around on how to create a ‘.pem’ file from a certificate and private key.

The code below is an excerpt from the PHP SOAP Client Example. The point to note here is that we have added the local_cert parameter which contains the value of our certificate file. Most importantly, we have also changed the protocol from http to https for both the wsdl and the soap server location parameters. 

3 comments:

  1. ¿Cuales son los pasos para crear un certificado (.pem) en windows 7?

    Saludos.-

    ReplyDelete
    Replies
    1. Certificate creation is beyond the scope of this post. But you can google for it as suggested in the introductory section of the post.

      Delete
  2. My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he's tryiong none tthe less. I've been using Movable-type on various websites for about a year and amm
    concerned about switching to another platform. I hawve heard fantastic things about blogengine.net.
    Is there a way I can transfer all myy wordpress content
    into it? Any kind of hslp would be really appreciated!

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...