beanymanuk Posted March 11, 2013 Share Posted March 11, 2013 Hi Am getting the below error on this line of code Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in /var/www/vhosts/extraspel.com/subdomains/en.qa/httpdocs/services/websiteheaderprovider.php:6 Stack trace: #0 [internal function]: SoapClient->__call('GetPlatformByUs...', Array) #1websiteheaderprovider.php(6): SoapClient->GetPlatformByUserAgent(Array) #2 {main} thrown in websiteheaderprovider.php on line 6 $result = ($client->GetPlatformByUserAgent($params)); Any ideas? Quote Link to comment Share on other sites More sharing options...
ignace Posted March 12, 2013 Share Posted March 12, 2013 (edited) We need to see your full code (or at least the relevant code) not just the line where the error occured. Edited March 12, 2013 by ignace Quote Link to comment Share on other sites More sharing options...
beanymanuk Posted March 12, 2013 Author Share Posted March 12, 2013 <?php $client = new SoapClient("http://externalservices.qa.gameserver1-mt.com/WebSiteServices.asmx?wsdl"); $aa = $_SERVER['HTTP_USER_AGENT']; $params = array(); $params["pUserAgent"] = $aa; $result = ($client->GetPlatformByUserAgent($params)); //print_r($result); foreach ($result as $res) { $res; } //echo $res." - "; if($res == "W") { //echo "DESKTOP"; ?><script type="text/javascript"> <!-- //window.location = "http://nl.info.qa.extraspel.com/" //--> </script> <?php } elseif($res == "S") { //echo "SMARTPHONE"; ?> <script type="text/javascript"> <!-- window.location = "http://nl.info.qa.extraspel.com/visit.aspx" //--> </script> <?php } elseif($res == "M") { //echo "MOBILE J2ME"; //header("Location: http://en.info.qa.extraspel.com/visit.aspx"); ?><script type="text/javascript"> <!-- window.location = "http://nl.info.qa.extraspel.com/visit.aspx" //--> </script><?php } ?> Quote Link to comment Share on other sites More sharing options...
ignace Posted March 12, 2013 Share Posted March 12, 2013 (edited) $wsdl = "http://externalservices.qa.gameserver1-mt.com/WebSiteServices.asmx?wsdl"; $options = array('exceptions' => true, 'trace' => true); $client = new SoapClient($wsdl, $options); try { $result = $client->GetPlatformByUserAgent(array('pUserAgent' => $_SERVER['HTTP_USER_AGENT'])); } catch (SoapFault $e) { echo '<pre>'; var_dump($client->__getLastRequestHeaders()); var_dump($client-> __getLastRequest()); echo '</pre>'; }When you pass true to the trace option of the SoapClient you can view the request he made and what went wrong. The webservice seems down from here, so I can't test it. Edited March 12, 2013 by ignace Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.