1

次の SOAP エンベロープを使用して Innovata SOAP Web リクエストを消費しようとしています

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:cus="http://CustomDataTimeTableToolKit.com/">
   <soap:Header>
      <cus:WSAuthenticate>
         <cus:CustomerRefCode>XYZ</cus:CustomerRefCode>
         <cus:Password>XXXXXXXX</cus:Password>
         <cus:WebServicesRefCode>xxx</cus:WebServicesRefCode>
      </cus:WSAuthenticate>
   </soap:Header>
   <soap:Body>
      <cus:GetSchedules>
         <cus:_sSchedulesSearchXML>&lt;GetSchedules_Input customerCode="XXX" productCode="external" dptCode="EDI" dptCodeType="STA" arvCode="LHR" arvCodeType="STA" flightDaysRange="3" MM="10" DD="11" YYYY="2012" searchType="B" cnxType="B" IncludeSummary="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="GetSchedules_Input.xsd"/&gt;</cus:_sSchedulesSearchXML>
      </cus:GetSchedules>
   </soap:Body>
</soap:Envelope>

動作しているように見えるが正しいデータを返さない次の PHP コードを書きました。

<?php


    $customerCode = 'XXX';
    $password = 'XXXX';

    $dptCode = 'EDI';
    $dptCodeType='STA';
    $arvCode='LHR'; 
    $arvCodeType='STA';


    $client = new SoapClient('http://ctk.innovataw3svc.com/ctk.asmx?WSDL', array('trace'=>1));
    $client->__setSoapHeaders(array(
        new SoapHeader('http://CustomDataTimeTableToolKit.com/', 
            'WSAuthenticate', 
            array(
                'CustomerRefCode' => $customerCode,
                'Password' => $password,
                'WebServicesRefCode' => 'TKC'
            )
        )
    ));
    $date = new DateTime();
    $in = new stdClass();
    $in->_sSchedulesSearchXML = sprintf(
        '<GetSchedules_Input customerCode="%s" productCode="external" dptCode="%s" dptCodeType="%s" arvCode="%s" arvCodeType="%s" flightDaysRange="3" MM="%s" DD="%s" YYYY="%s" searchType="B" cnxType="B" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="GetSchedules_Input.xsd" />',
        $customerCode, 
        $dptCode, 
        $dptCodeType, 
        $arvCode, 
        $arvCodeType, 
        $date->format('m'), 
        $date->format('d'),
        $date->format('Y')
    );


    try{
        $result = $client->GetSchedules($in);
        print_r($result);
    }
    catch(SoapFault $e){
        echo "Soap Fault: ".$e->getMessage();
    }

出力は次のとおりです。

stdClass Object ( [GetSchedulesResult] => S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 320 0 S S S S S S S S S S S S S S S S S 319 0 M M M M M M M M M M M M M M M M M ER4 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 M M M M M M M M M M M M M M M M M ER4 0 M M M M M S S S S S S S S S S S S 319 0 S S S S S S S S S S S S S S S S S 319 0 M M M M M S S S S S S S S S S S S 319 0 M M M M M M M M M M M M M M M M M ER4 0 M M M M M S S S S S S S S S S S S 319 0 )

問題がどこにあるのか本当にわかりません。どんな助けでも大歓迎です。

ありがとう

4

1 に答える 1

1

そのため、デバッグを Web ページに出力していたようで、ブラウザがページをレンダリングしようとしたときに XML が取り除かれていました。表示されていた出力は、食事コード、ストップなどでした。

つまり、期待どおりの応答が常に得られました。

その場合は、を使用せず__getLastResponse()、$result をオブジェクトとして処理し、必要に応じて解析します。

于 2012-10-15T21:12:06.013 に答える