Turning a SOAP response into an STD object with PHP -
i learning soap project , understand basics of it. can't believe i've never tried using before. it's great. anyway, problem.
i have managed print response of request web browser cannot seem convert response std object.
i've been next tutorial , adapting different wdsl file understand i'm doing.
this php file.
<? ////////////////////////////////////// // // about: file send request wsdl file , homecoming result in browser window // author: brad bird // date: 07/02/2013 // ////////////////////////////////////// // setup soap client options $wsdl = "http://www.mobilefish.com/services/web_service/countries.php?wsdl"; $options = array( "trace" => 1, "exception" => 0 ); // creates new instance of soap client $client = new soapclient($wsdl, $options); // homecoming set of info using 1 function $countrycode = "af"; $values = $client->countryinfobyiana($countrycode); // prints details of request , response browser print "<h2>soap details</h2>"; print "<pre>"; print "<h3>request</h3> " . htmlspecialchars($client->__getlastrequest()) . "<br />"; print "<h3>response</h3> " . htmlspecialchars($client->__getlastresponse()); print "</pre>"; // prints request in xml format $xml = $values->countryinfobyianaresponse; print "<h2>stdclass object</h2>"; print "<pre>"; print_r($xml); print "</pre>"; and wsdl file i'm trying request here. http://www.mobilefish.com/services/web_service/countries.php?wsdl
for reason std object section showing nothing. ideas?
well, $xml not object of stdclass, null. $values is. $values->countryinfobyianaresponse not exist. have in $values is
: object(stdclass) = ianacode: string = "af" countryname: string = "afghanistan" latitude: double = 33.93911 longitude: double = 67.709953 not sure trying - maybe phone call method on $client rather on result? also, check php manual on error_reporting, have stumbled across notice: undefined property: stdclass::$countryinfobyianaresponse in print_r line.
php soap wsdl stdclass
No comments:
Post a Comment