Jump to content

Recommended Posts

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?
 

Link to comment
https://forums.phpfreaks.com/topic/275522-soapclient-error/
Share on other sites


<?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
}
?>
 
Link to comment
https://forums.phpfreaks.com/topic/275522-soapclient-error/#findComment-1418130
Share on other sites

$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 by ignace
Link to comment
https://forums.phpfreaks.com/topic/275522-soapclient-error/#findComment-1418147
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.