2
我在執行此搜索請求時遇到了大問題。創建WSDL PHP請求返回內部錯誤
首先,我需要驗證自己,這工作正常。
然後我需要添加安全令牌到請求頭,這也很容易。
但是,當我試圖創建搜索請求時,我可以得到服務器的積極響應。
$url = 'http://devapi.stellatravelgateway.stellatravelservices.co.uk/AirService.svc?wsdl';
$search = new SoapClient($url , array('trace' => true));
$header = new SoapHeader('http://devapi.stellatravelgateway.stellatravelservices.co.uk','AuthHeader', $token, true);
$search->__setSoapHeaders(array($header)); ?>
<h1>Search</h1> <?php var_dump($search);
$ser_par = array(
'request'=>array(
'SelectedAirlines' => array(),
'MaximumConnectionTimeMins' => '',
'MaxResultsPerAirline' => '',
'JourneyDetails' => array(
'JourneyDetail'=> array(
'DepartureDateTime' => '2012-12-01T17:20:58',
'DeparturePoint' => 'LON',
'DeparturePointIsCity' => false,
'DestinationPoint' => 'MLE',
'DestinationPointIsCity' => false,
'ViaPointAirportCode' => ''),
'JourneyDetail' => array(
'DepartureDateTime' => '2012-12-15T17:20:58',
'DeparturePoint' => 'MLE',
'DeparturePointIsCity' => false,
'DestinationPoint' => 'LON',
'DestinationPointIsCity' => false,
'ViaPointAirportCode' => ''
)),
'SearchType' => 'Availability',
'FlexiDays' => 0,
'FareType' => 'All',
'SearchSource' =>'Default',
'ReturnIncompleteResults' => false,
'SortOrder' => 'Price',
'ChildPaxCount' => 1,
'AdultPaxCount' => 1,
'DirectFlightsOnly' => false,
'CabinClass' => 'All',
'InfantWithSeatPaxCount' => 0,
'InfantPaxCount' => 1,
'MaxResultsPerAirline' => '',
'MaxResults' => '',
'IncludePriorDepartues' => false,
'SessionID'=> '070ed09a-ec58-4eee-a7d9-31942e968a3c',
));
try{
$search->Search(array($ser_par));
}catch(SoapFault $e){
echo '<h1> Errors: </h1>';
var_dump($e);
}
這是輸出:
Search
object(SoapClient)#218 (4) { ["trace"]=> int(1) ["_soap_version"]=> int(1) ["sdl"]=> resource(108) of type (Unknown) ["__default_headers"]=> array(1) { [0]=> object(SoapHeader)#219 (4) { ["namespace"]=> string(60) "http://devapi.stellatravelgateway.stellatravelservices.co.uk" ["name"]=> string(10) "AuthHeader" ["data"]=> string(36) "149db61f-c1d6-49e2-bf37-430ec3526053" ["mustUnderstand"]=> bool(true) } } }
Errors:
object(SoapFault)#220 (9) { ["message":protected]=> string(433) "The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs." ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(96) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-content/themes/responsive/page.php" ["line":protected]=> int(151) ["trace":"Exception":private]=> array(5) { [0]=> array(6) { ["file"]=> string(96) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-content/themes/responsive/page.php" ["line"]=> int(151) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(6) "Search" [1]=> array(1) { [0]=> array(1) { [0]=> array(1) { ["request"]=> array(19) { ["SelectedAirlines"]=> array(0) { } ["MaximumConnectionTimeMins"]=> string(0) "" ["MaxResultsPerAirline"]=> string(0) "" ["JourneyDetails"]=> array(1) { ["JourneyDetail"]=> array(6) { ["DepartureDateTime"]=> string(19) "2012-12-15T17:20:58" ["DeparturePoint"]=> string(3) "MLE" ["DeparturePointIsCity"]=> bool(false) ["DestinationPoint"]=> string(3) "LON" ["DestinationPointIsCity"]=> bool(false) ["ViaPointAirportCode"]=> string(0) "" } } ["SearchType"]=> string(12) "Availability" ["FlexiDays"]=> int(0) ["FareType"]=> string(3) "All" ["SearchSource"]=> string(7) "Default" ["ReturnIncompleteResults"]=> bool(false) ["SortOrder"]=> string(5) "Price" ["ChildPaxCount"]=> int(1) ["AdultPaxCount"]=> int(1) ["DirectFlightsOnly"]=> bool(false) ["CabinClass"]=> string(3) "All" ["InfantWithSeatPaxCount"]=> int(0) ["InfantPaxCount"]=> int(1) ["MaxResults"]=> string(0) "" ["IncludePriorDepartues"]=> bool(false) ["SessionID"]=> string(36) "070ed09a-ec58-4eee-a7d9-31942e968a3c" } } } } } } [1]=> array(6) { ["file"]=> string(96) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-content/themes/responsive/page.php" ["line"]=> int(151) ["function"]=> string(6) "Search" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> array(1) { [0]=> array(1) { ["request"]=> array(19) { ["SelectedAirlines"]=> array(0) { } ["MaximumConnectionTimeMins"]=> string(0) "" ["MaxResultsPerAirline"]=> string(0) "" ["JourneyDetails"]=> array(1) { ["JourneyDetail"]=> array(6) { ["DepartureDateTime"]=> string(19) "2012-12-15T17:20:58" ["DeparturePoint"]=> string(3) "MLE" ["DeparturePointIsCity"]=> bool(false) ["DestinationPoint"]=> string(3) "LON" ["DestinationPointIsCity"]=> bool(false) ["ViaPointAirportCode"]=> string(0) "" } } ["SearchType"]=> string(12) "Availability" ["FlexiDays"]=> int(0) ["FareType"]=> string(3) "All" ["SearchSource"]=> string(7) "Default" ["ReturnIncompleteResults"]=> bool(false) ["SortOrder"]=> string(5) "Price" ["ChildPaxCount"]=> int(1) ["AdultPaxCount"]=> int(1) ["DirectFlightsOnly"]=> bool(false) ["CabinClass"]=> string(3) "All" ["InfantWithSeatPaxCount"]=> int(0) ["InfantPaxCount"]=> int(1) ["MaxResults"]=> string(0) "" ["IncludePriorDepartues"]=> bool(false) ["SessionID"]=> string(36) "070ed09a-ec58-4eee-a7d9-31942e968a3c" } } } } } [2]=> array(4) { ["file"]=> string(90) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-includes/template-loader.php" ["line"]=> int(43) ["args"]=> array(1) { [0]=> string(96) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-content/themes/responsive/page.php" } ["function"]=> string(7) "include" } [3]=> array(4) { ["file"]=> string(77) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-blog-header.php" ["line"]=> int(16) ["args"]=> array(1) { [0]=> string(90) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-includes/template-loader.php" } ["function"]=> string(12) "require_once" } [4]=> array(4) { ["file"]=> string(68) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/index.php" ["line"]=> int(17) ["args"]=> array(1) { [0]=> string(77) "/home/sites/simplymaldivesholidays.co.uk/public_html/feeds/wp-blog-header.php" } ["function"]=> string(7) "require" } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(433) "The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs." ["faultcode"]=> string(22) "a:InternalServiceFault" }
這裏是唯一的資源文件,我已經得到了。
文檔: http://devapi.stellatravelgateway.stellatravelservices.co.uk/documentation/
XML文檔: http://devapi.stellatravelgateway.stellatravelservices.co.uk/AirService.svc?wsdl
這是樣品搜索請求。我試圖使用這些值,但不成功。
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://stellatravelgateway.stellatravelservices.co.uk/AirService/IAirService/Search</Action>
<AuthHeader xmlns="http://stellatravelgateway.stellatravelservices.co.uk">a80681e2-e70f-4bf0-ab0f-df81a6449c6d</AuthHeader>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Search xmlns="http://stellatravelgateway.stellatravelservices.co.uk/AirService">
<request SearchType="Availability" FlexiDays="0" FareType="All" SearchSource="Default" ReturnIncompleteResults="false" SortOrder="Price" ChildPaxCount="1" AdultPaxCount="1" DirectFlightsOnly="false" CabinClass="All" InfantWithSeatPaxCount="0" InfantPaxCount="1">
<SelectedAirlines />
<MaxResultsPerAirline xsi:nil="true" />
<JourneyDetails>
<JourneyDetail DepartureDateTime="2012-12-01T17:20:58" DeparturePoint="LON" DeparturePointIsCity="false" DestinationPoint="MLE" DestinationPointIsCity="false" ViaPointAirportCode="" />
<JourneyDetail DepartureDateTime="2012-12-15T17:20:58" DeparturePoint="MLE" DeparturePointIsCity="false" DestinationPoint="LON" DestinationPointIsCity="false" ViaPointAirportCode="" />
</JourneyDetails>
<MaxResults xsi:nil="true" />
<IncludePriorDepartues>false</IncludePriorDepartues>
<SessionID>070ed09a-ec58-4eee-a7d9-31942e968a3c</SessionID>
</request>
</Search>
</s:Body>
</s:Envelope>
我的問題是:我在這裏做什麼錯了? 任何幫助將不勝感激。 致以問候 PawikSD
響應消息表明它是服務器端錯誤。你是控制服務器還是這是第三方服務? – Adrian
這是第三方服務,它們不提供任何對php的支持。他們所做的只是.NET。 – Pawiskd
他們不需要支持PHP(我必須經常處理相同的情況)。在尋求支持時,向他們發送您發送的SOAP請求以及您收到的響應;您用於生成請求的語言無關緊要 - 這是SOAP的一半。 – Adrian