Solved

SOAP in PHP5 With Client Certificate Authentication

Posted on 2004-08-04
3
2,471 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.

758 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

20 Experts available now in Live!

Get 1:1 Help Now