RE: [SOAP] patch for PEAR::SOAP over HTTPS/SSL with certificates

From: Date: Wed, 19 Mar 2003 07:28:04 +0000
Subject: RE: [SOAP] patch for PEAR::SOAP over HTTPS/SSL with certificates
Groups: php.soap 
Request: Send a blank email to php-soap+get-478@lists.php.net to get a copy of this message
Ah, nice ! I never got around to finish this. We did a dirty hack at work which i intended to write in a cleaner way but that is very nice. Shane's more generic approach makes a lot of sense to me. My objection against accessing properties directly are two fold, first it's dirty, second, with php5 it will not be possible to accessa private properties directly. I can see an extension for the generic approach, when you need to send a cookie in the HTTP request or other headers for that matter the generic approach would make it very easy. Or maybe there is a way which i overlooked. Arnaud. > I finally have PEAR::SOAP over HTTPS/SSL with certificates working. > > In order to do this, PEAR::SOAP needs to be enhanced to allow client > applications the ability to set arbitrary curl options. > > I followed the approach that Peter Clarke suggested earlier for > this, but I have added a public interface to resolve an objection > from Arnaud Limbourg. > > So here are my proposed patches to SOAP/Client.php and to > SOAP/Transport/HTTP.php: > > > *** Client.php..orig 2002-12-01 14:51:15.000000000 -0800 > --- Client.php 2003-03-18 03:36:08.000000000 -0800 > *************** > *** 185,190 **** > --- 185,207 ---- > } > > /** > + * curlSetopt > + * > + * To set curl options when using https, you use this function, > + * passing it the same arguments as you would for curl_setopt. > + * > + * @param curl_setopt option > + * @param curl_setopt value > + * > + * @access public > + */ > + function curlSetopt($curl_setopt_option, $curl_setopt_value) > + { > + # store the curl_setopt parameters for retrieval before call > + $this->__options['curlopt'][$curl_setopt_option] = > $curl_setopt_value; > + } > + > + /** > * SOAP_Client::call > * > * the namespace parameter is overloaded to accept an array of > > > *** HTTP.php..orig 2002-10-19 12:43:54.000000000 -0700 > --- HTTP.php 2003-03-18 03:44:41.000000000 -0800 > *************** > *** 360,366 **** > curl_setopt($ch, CURLOPT_FAILONERROR, 1); > curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > ! curl_setopt($ch, CURLOPT_VERBOSE, 1); > $this->response = curl_exec($ch); > curl_close($ch); > > --- 360,371 ---- > curl_setopt($ch, CURLOPT_FAILONERROR, 1); > curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > ! if (isset($options['curlopt'])) { > ! reset($options['curlopt']); > ! while (list($key, $val) = each ($options['curlopt'])) { > ! curl_setopt($ch, $key, $val); > ! } > ! } > $this->response = curl_exec($ch); > curl_close($ch); > > > A sample client usage of the new interface would be: > > $soapclient = new > SOAP_Client("https://whatever.com/whatever.php"); > $options = array('namespace' => 'urn:jls-whatever', > 'trace' => 1); > $soapclient->curlSetopt(CURLOPT_VERBOSE, 1); > $soapclient->curlSetopt(CURLOPT_SSL_VERIFYHOST, 1); > $soapclient->curlSetopt(CURLOPT_SSL_VERIFYPEER, 1); > $soapclient->curlSetopt(CURLOPT_SSLCERT, > "/home/jls/jls-both.pem"); > $soapclient->curlSetopt(CURLOPT_SSLCERTPASSWD, "jls123"); > $soapclient->curlSetopt(CURLOPT_CAINFO, > "/home/jls/cacert.pem"); > $ret = $soapclient->call(...) > > The jls-both.pem file has to be a catenation of a signed certificate > request and a private key (see the curl --cert man page description). > > Jonathan Schilling Caldera/SCO jls@sco.com > > -- > PHP Soap Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.soap (#478) next »