doubi4617 2013-07-03 06:43
浏览 54
已采纳

SoapClient返回“NULL”,但__getLastResponse()返回XML

The variable $response in the below code is NULL even though it should be the value of the SOAP request. (a list of tides). When I call $client->__getLastResponse() I get the correct output from the SOAP service.

Anybody know what is wrong here? Thanks! :)

Here is my code :

$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 "

".$e->getMessage();
}
var_dump($result);
  • 写回答

2条回答 默认 最新

  • duanmu8911 2014-09-26 09:26
    关注

    The reason that the $result (or the response to the SoapCall) is null is indeed because the WSDL is invalid.

    I just ran into the same problem - the WSDL said the response should be PackageChangeBatchResponse yet the actual XML returns has PackageChangeResponse

    Changing the WSDL to match the response / changing the response to match the WSDL resolves the issue

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?