Solved

SOAP in PHP5 With Client Certificate Authentication

Posted on 2004-08-04
3
2,476 Views
Last Modified: 2010-09-10
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
Comment
Question by:marko020397
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Hatemben earned 500 total points
ID: 11724190
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
 
LVL 4

Author Comment

by:marko020397
ID: 11724277
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
 
LVL 2

Expert Comment

by:Hatemben
ID: 11724317
Yep you won't find documentation in soap, read better in curl related stuff.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now