下面的代碼中的變量$ response即使它應該是SOAP請求的值,也是NULL。 (潮汐表)。當我調用$ client - > __ getLastResponse()時,我從SOAP服務獲得正確的輸出。SoapClient返回「NULL」,但__getLastResponse()返回XML
有人知道這裏有什麼問題嗎?謝謝! :)
這裏是我的代碼:
$options = array(
"trace" => true,
"encoding" => "utf-8"
);
$client = new SoapClient("http://opendap.co-ops.nos.noaa.gov/axis/webservices/highlowtidepred/wsdl/HighLowTidePred.wsdl", $options);
$params = array(
"stationId" => 8454000,
"beginDate" => "20060921 00:00",
"endDate" => "20060922 23:59",
"datum" => "MLLW",
"unit" => 0,
"timeZone" => 0
);
try {
$result = $client->getHLPredAndMetadata($params);
echo $client->__getLastResponse();
}
catch (Exception $e) {
$error_xml = $client->__getLastRequest();
echo $error_xml;
echo "\n\n".$e->getMessage();
}
var_dump($result);
哪裏是$迴應? – Matheno
由WSDL,在SOA p響應不正確(由服務器),所以客戶端無法解析它。我已經測試了您的代碼,並且響應XML包含HighLowValues標記,但它與'getHighLowTidePredictionsResponse'函數相關。 – Fracsi
@Frasci:您的解決方案奏效。謝謝! :) – Padraig