Solved

SOAP in PHP5 With Client Certificate Authentication

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move wordpress site 3 38
How to count in a table in php 22 36
mysql between clause 2 24
PHP curl issue VERBOSE output 18 42
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 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