1

我正在尝试使用以下肥皂信封来处理 Innovata 肥皂网络请求

<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

因此,看起来您正在将调试输出到网页,并且在浏览器尝试呈现页面时 XML 被剥离。您看到的输出是用餐代码、停靠点等。

换句话说,您总是得到预期的响应。

如果是这种情况,请不要使用__getLastResponse(),而只需将 $result 作为对象处理,并根据需要对其进行解析。

于 2012-10-15T21:12:06.013 回答