梨皂客户端和Web服务问题

时间:2014-07-10 14:00:57

标签: web-services soap pear

我正在尝试对气象服务进行简单的肥皂调用,并且我一直收到无效的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); 
}

1 个答案:

答案 0 :(得分:0)

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


他们的服务不是SOAP服务。 wiki states

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