problem getting results from web services

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ndowdall
Forum Newbie
Posts: 4
Joined: Tue Jul 11, 2006 9:49 am

problem getting results from web services

Post by ndowdall »

I am trying to use the following web service to get a weather report for my site.
http://www.webservicex.net/globalweather.asmx
However the page returns no results. Anyone got any ideas as to what is wrong with my code. I have tested the web service using asp.net and it is working so it must be my code

Code: Select all

<html>
<head><title>web services</title></head>
<body>
<?php
require_once('../Connections/soap/nusoap.php');
$client = new soapclient("http://www.webservicex.net/globalweather.asmx");

$result="";
$result = $client ->call('GetWeather','Dublin,Ireland');
echo $result;
?>
</body>
</html>
Any ideas?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

ndowdall
Forum Newbie
Posts: 4
Joined: Tue Jul 11, 2006 9:49 am

Post by ndowdall »

Thanks astions will give it a try.
ndowdall
Forum Newbie
Posts: 4
Joined: Tue Jul 11, 2006 9:49 am

Post by ndowdall »

That works but now would I insert the output into my own page.
What I am trying to do is to have some of the returned data displayed on the top of the page.

Regards
ndowdall
ndowdall
Forum Newbie
Posts: 4
Joined: Tue Jul 11, 2006 9:49 am

Post by ndowdall »

I am still having trouble. I have the following code

Code: Select all

<?php
	require_once('../nusoap.php');
	$country_name='Ireland';
	$parameters=array('CountryName' => $country_name);
	$sclient= new soapclient('http://www.webserviceX.NET/Globalweather.asmx');
	$result = $sclient->call('GetCitiesByCountry' , $parameters);
	foreach ($result as $name_val)
	{
		echo $name_val;
	}
	?>
which i think should just output a list of citys in the country supplied in this case Ireland.
Put instead i am getting this error message at lest i think it's an error message.

Code: Select all

soap:ClientSystem.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: . at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
Any one got an idea of whats wrong as i can see nothing. the service address is
http://www.webservicex.net/globalweather.asmx
Post Reply