Jump to content

SoapClient Error


beanymanuk

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.