2

この検索リクエストを行う際に大きな問題があります。

まず、自分自身を認証する必要がありますが、それは正常に機能しています。

次に、リクエスト ヘッダーにセキュリティ トークンを追加する必要があります。これも非常に簡単です。

しかし、検索リクエストを作成しようとすると、サーバーから肯定的な応答を得ることができます。

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

私の質問は次のとおりです。ここで間違っていることは何ですか? どんな助けでも大歓迎です。よろしくお願いします

4

1 に答える 1

0

助けてくれてどうもありがとう。なんとか整理できました。適切なリクエスト形式を取得するために SoapUI を使用しました。次に、それをコピーして curl リクエストとして送信しました。魅力のように機能します。ありがとう

于 2013-01-23T16:29:44.397 に答える