Php SOAP请求未返回正确的数据
我正在尝试使用以下soap信封使用Innovata soap web请求Php SOAP请求未返回正确的数据,php,soap,wsdl,Php,Soap,Wsdl,我正在尝试使用以下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:CustomerRefCod
<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>
我真的不知道问题出在哪里,非常感谢您的帮助
谢谢所以,看起来您正在将调试输出到网页,而当浏览器试图呈现网页时,XML被剥离。您看到的输出是用餐代码、站点等 换句话说,你总是得到你期望的回应
如果是这种情况,不要使用
\uu getLastResponse()
,只需将$result作为对象处理,并根据需要对其进行解析。因此,看起来您正在将调试输出到网页,而当浏览器试图呈现网页时,XML被剥离。您看到的输出是用餐代码、站点等
换句话说,你总是得到你期望的回应
如果是这种情况,请不要使用
\uu getLastResponse()。你做了一个soap请求,得到了一个结果——在这一点上对我来说是有效的。您期望的是什么?您是否尝试回显SOAP数据?我会尝试查看$client->\uuu getLastResponses()
,以及$client->\uu getLastRequest()
;非常感谢你的回复。我会试试看。预期的输出是(粘贴在粘贴箱上)谢谢问题是:我也看不出问题在哪里。你做了一个soap请求,得到了一个结果——在这一点上对我来说是有效的。您期望的是什么?您是否尝试回显SOAP数据?我会尝试查看$client->\uuu getLastResponses()
,以及$client->\uu getLastRequest()
;非常感谢你的回复。我会试试看。预期的输出是(粘贴在pastebin上)谢谢您碰巧将调试结果输出到HTML页面-这会隐藏您预期的所有XML标记,但它们确实存在!在这种情况下,始终添加对htmlspecialchars()
的调用。您碰巧将调试结果输出到一个HTML页面中-这会隐藏您期望的所有XML标记,但它们确实存在!在这种情况下,始终添加对htmlspecialchars()
的调用。
<?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 )