[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2595
  • Last Modified:

SOAP in PHP5 With Client Certificate Authentication

Hi!

I have installed PHP 5 with SOAP support. I have to make a SOAP client application. The problem is that the SOAP Server requires client certificate authentication via HTTPS protocol. I have found an example how to make username and password authentication but not client certificate authentication. A quick browse through SOAP PHP source module didn't give me any hope that this could be achieved. Does anyone has an idea how to do this?
0
marko020397
Asked:
marko020397
  • 2
1 Solution
 
HatembenCommented:
I think there isn't yet a support for certificate in the SOAP extension in PHP5. I've checked the SOAP sources to see if it's possible to bypass ssl using curl but can't see how to do it ! anyway, I just know that  with PEAR SOAP, you can do something like this :

<?php

$ClientCode = "ClientCode";
$UserID = "UserID";
$UserPassword = "password";
$params = array('ClientCode'=>$ClientCode, 'UserID'=>$UserID,'UserPassword'=>$UserPassword);
$client = new SOAP_Client( "https://secure.someservice.net/path_to_soap_server");

// bypass SSL certificate with CURL
$client->setOpt('curl', CURLOPT_VERBOSE, 1);
$client->setOpt('curl', CURLOPT_POST, 1);
$client->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
$client->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);


$response = $client->call(....);

if (strtolower(get_class($response)) == "soap_fault") {
      print "Error! " . $response->message;
}else {
      print "{". print_r($response) ."}";
}

?>


Hope this will help
Hatem
0
 
marko020397Author Commented:
Thanks. Now I know I will have to do it with PEAR SOAP. The source you sent is very helpfull but there is not an example of sending a certificate. A certificate should be supplied via CURLOPT_SSLCERT, CURLOPT_SSLKEY, CURLOPT_CAINFO parameters. The parameters you supplied should also have other values.
0
 
HatembenCommented:
Yep you won't find documentation in soap, read better in curl related stuff.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now