2017-10-14 103 views
0

我想要從SOAP API獲取數據。更多細節在這裏: https://iskam-web.zcu.cz/WebServices/Menus.asmx?op=FacilitiesPHP SOAP請求 - 獲得空結果

這裏有要求的信息: enter image description here

和我的PHP代碼如下所示:

$soap = new SoapClient("https://iskam-web.zcu.cz/WebServices/Menus.asmx?wsdl"); 
    $xml = $soap->Facilities(array()); 

    print "<pre>"; 
    print_r($xml); 
    print "</pre>"; 

但得到的答覆我得到這個樣子的:

enter image description here

所以它意味着結果我是空的。有什麼我在做什麼錯誤或API是不工作?

謝謝!

回答

1

設施方法,在wsdl它沒有指定什麼,甚至不需要傳遞什麼數據。只是你沒有做錯任何事情,但設施方法返回一個空的對象。意思是沒有數據。 這是從設施的XML響應:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <FacilitiesResponse xmlns="http://aps-brno.cz/"/> 
    </soap:Body> 
</soap:Envelope> 

在這種情況下,我建議從到達Web服務的支持,一些支持。

如果你試圖調用

$soap = new SoapClient("https://iskam-web.zcu.cz/WebServices/Menus.asmx?wsdl"); 
     $response = $soap->DistributionPeriods(['FacilityID' => '123123123123123-123123123-123123123', 'Day' => '4']); 

     print "<pre>"; 
     print_r($response); 
     print "</pre>"; 

會要求你通過格式化像一個設施ID:Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。這樣我相信你會得到一些數據。