我正在尝试使用以下肥皂信封来处理 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><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"/></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 )
我真的不明白问题出在哪里,非常感谢任何帮助。
谢谢