?
Solved

SOAP in PHP5 With Client Certificate Authentication

Posted on 2004-08-04
3
Medium Priority
?
2,539 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Hatemben earned 1500 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

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

764 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