Pear SoapClient and Webservice Issue



我试图做一个简单的soap调用天气服务,我一直得到无效的ZIP错误。有人能告诉我我做错了什么下面是我的代码。

感谢
require_once 'SOAP/Client.php'; 
$client = new Soap_Client('http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL'); 
$method = 'GetCityWeatherByZIP'; 
$params = array('ZIP' => '07108');   
$result = $client->call($method, $params); 
if (PEAR::isError($result)) { 
echo $result->getMessage(); 
} else { 
print_r($result); 
}

使用PHP的内置SOAP客户端。在PEAR中,它是在PHP本身还没有它的时候编写的。


其服务不是SOAP服务。维基声明:

$url = "http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityForecastByZIP";
$url .= "?ZIP=" . $this->ZipCode;
$this->response = simplexml_load_file($url) or die("ERROR");

最新更新