I have spent a few days trying to get my web services to work, allegedly it should be so easy. I have the following code, that aims to retrieve information from a web service built with a WSDL.
<?php
// include the SOAP classes
require_once('../lib/nusoap.php');
// define parameter array (ISBN number)
$param = array('CityName'=>'Oslo', 'CountryName'=>'Norway');
// define path to server application
$serverpath ='http://www.webservicex.net/globalweather.asmx';
// create client object
$client = new soapclient($serverpath);
// $p = $serverpath->getProxy();
// make the call
$result = $client->call('GetWeather', $param);
// if a fault occurred, output error info
if(!$err = $client->getError())
{
echo 'Result: '. $result;
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo '<h2>Error: </h2>';
echo '<xmp>' . $err . '</xmp>';
// kill object
unset($client);
?> |
So this returns an error message saying "Server did not recognize the value of HTTP Header SOAPAction", and an HTML error code 500; "Internal Server Error".
Information on this particular service was found here:
http://www.webservicex.net/WS/WSDetails.aspx?CATID=12&WSID=56
Any help deeply appreciated.