Php Error Finding Uri Property
worldTimeZone extends SoapClient { private $soapurl='http://www.earthtools.org/'; private $long=0; //-74.00639 private $latitude=0; //40.71417 private $final_url=NULL; //timezone/ function __construct($long,$latitude) { $this->long=$long; $this->latitude=$latitude; $this->final_url=$this->soapurl; try{ return new SoapClient(NULL,array('location'=>$this->final_url,'uri'=> "http://test-uri/","trace"=> 1,"exceptions" => 0)); }catch(Exception $e) { echo '
'; var_dump($e); } } function WB_function() { echo ''; return $this->_getFunctions(); } } $l=-74.00639; $la=40.71417; $sobj=new worldTimeZone($l,$la); $v=$sobj->__soapCall('timezone',array($l,$la)); Error:Fatal error: Uncaught SoapFault exception: [Client] Error finding "uri" property in C:\www\list.php:35 Any idea ...whats wrong...! Or where I am making mistake in my class definition or method... salathe 2011-09-21 12:10:26 UTC #2 There are a few key issues with your code, I'll outline them briefly. You are not properly constructing the extended SoapClient. return new SoapClient(...) should be parent::__construct(...). Constructor methods should never return anything. The next issue, and this is the big one, the EarthTools web services (docs) do not talk SOAP. They're plain XML that you need to figure out how to a) construct the correct URLs for your needs (looks like you can do this already), and b) parse the response XML into PHP variables yourself. For part b), there are lots of tools available including DOM, SimpleXML and XMLReader. See http://php.net/refs.xml A very basic example would look like: isotime; echo $localtime; // e.g. 2011-09-21 07:09:50 -0500 Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Shop Versioning Reference Articles Premiumhere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack https://www.sitepoint.com/community/t/trying-to-call-webservice-from-soapclient/91449 Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Fatal error: Uncaught SoapFault exception: [Client] Error finding “uri” property in up vote 0 down vote favorite The title yields me some SO links but unfortunately I couldn't get http://stackoverflow.com/questions/39855931/fatal-error-uncaught-soapfault-exception-client-error-finding-uri-property them to work. I am totally new to SOAP. I have been given a wsdl link and there are some method I need to call through soap. I am stuck at a particular point where it says Uncaught SoapFault exception: [Client] Error finding "uri" property in there error is generating at this code. class SoapClientCompatibility extends SoapClient{ public function __construct($wsdl, $options){ // do things here, like: // download the wsdl using curl }}function soapClientWSSecurityHeader($user, $password){ // Creating date using yyyy-mm-ddThh:mm:ssZ format $tm_created = gmdate('Y-m-d\TH:i:s\Z'); $tm_expires = gmdate('Y-m-d\TH:i:s\Z', gmdate('U') + 180); //only necessary if using the timestamp element // Generating and encoding a random number $simple_nonce = mt_rand(); $encoded_nonce = base64_encode($simple_nonce); // Compiling WSS string $passdigest = base64_encode(sha1($simple_nonce . $tm_created . $password, true)); // Initializing namespaces $ns_wsse = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; $ns_wsu = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; $password_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest'; $encoding_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'; // Creating WSS identification header using SimpleXML $root = new SimpleXMLElement('
'); $security = $root->addChild('wsse:Security', null, comMar 5, 2009 at 10:33 pm http://grokbase.com/t/php/php-bugs/0935wyr7a0/47581-new-calling-construct-from-an-extended-soapclient-class-via-variable-broken From: starson dot hochschild at mtginfo dot comOperating system: Linux RedHat Enterprise V4PHP version: 5.2.9PHP Bug Type: SOAP relatedBug description: Calling __construct from an extended SoapClient class via variable brokenDescription:------------I just upgraded from 5.1.6 to 5.2.9.Calling __construct php error from an extended SoapClient class via variable used towork but this is no longer the case. Somehow it gets picked up by __callnow.Calling __construct from an extended SoapClient class explicitly stillworks.Calling SoapClient from an extended SoapClient class via php error finding variable stillworks. I did not include an example for this, though.This is definitely not a show-stopper but it would be nice to haveconsistency.I haven't noticed this with any other classes, but then again using avariable to call __construct isn't exactly common.Reproduce code:---------------Expected result:----------------131517Actual result:--------------1315Fatal error: Uncaught SoapFault exception: [Client] Error finding "uri"property in /path/to/script.php:10Stack trace:#0 [internal function]: SoapClient->__call('__construct', Array)#1 /path/to/script.php(10): SoapClient->__construct('http://example...',Array)#2 /path/to/script.php(16):SoapClientVariable->__construct('http://example...', Array)#3 {main}thrown in /path/to/script.php on line 10--Edit bug report at http://bugs.php.net/?id=47581&edit=1--Try a CVS snapshot (PHP 5.2): http://bugs.php