note 97095 added to soapclient.soapclient
| From: | peter at webacoustics dot com | Date: | Thu, 01 Apr 2010 05:58:19 +0000 |
| Subject: | note 97095 added to soapclient.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167609@lists.php.net to get a copy of this message | ||
I found that WSDL fetching fails when using basic authentication in the soapclient. The fix noted
here (http://nl3.php.net/manual/en/ref.soap.php#41068) didn't work for me, so I implemented the
following workaround using wget. I realize wget may not be an option for some environments, in that
case cURL would be the next simplest thing.
$wsdl = get_wsdl("https://somehost.com/soap/service?wsdl");
$this->client = new SoapClient($wsdl, array('user'=>'someuser',
'password'=>'somepassword'));
private function get_wsdl($url) {
global $g;
$url = escapeshellarg($url);
$cache_file = "/tmp/soap.wsdl." . md5($url);
//only fetch a new wsdl every hour
if(!file_exists($cache_file) || filectime($cache_file) < time() - 3600) {
$agent = escapeshellarg("--user-agent={$g['useragent']}");
mwexec("wget --quiet --timeout=5 {$agent} --no-check-certificate
--output-document={$cache_file} {$url}");
if(!file_exists($cache_file)) {
throw new Exception("Couldn't load WSDL at {$url}");
}
}
return $cache_file;
}
----
Server IP: 64.71.164.2
Probable Submitter: 96.224.241.136
----
Manual Page -- http://www.php.net/manual/en/soapclient.soapclient.php
Edit -- https://master.php.net/note/edit/97095
Del: integrated -- https://master.php.net/note/delete/97095/integrated
Del: useless -- https://master.php.net/note/delete/97095/useless
Del: bad code -- https://master.php.net/note/delete/97095/bad+code
Del: spam -- https://master.php.net/note/delete/97095/spam
Del: non-english -- https://master.php.net/note/delete/97095/non-english
Del: in docs -- https://master.php.net/note/delete/97095/in+docs
Del: other reasons-- https://master.php.net/note/delete/97095
Reject -- https://master.php.net/note/reject/97095
Search -- https://master.php.net/manage/user-notes.php