php soap 使用问题, 服务器未能识别 HTTP 头 SOAPAction 的值
问题只是个引子了, 请看这里:
第一次使用PHP soap, 接一个酒店平台的API, http://etshotel.ziyou.com.cn/ETSHotel...
网上转了一大圈, 凑得如下代码, 却还是漏洞百出-
<?
try{
$client = new SoapClient(null,array('location'=>"http://etshotel.ziyou.com.cn/ETSHotelService.asmx?WSDL",'uri'=>"http://hotel.webservice.ets/",'SOAPAction'=>"http://hotel.webservice.ets/GetHotelList"));
$arr=array(
'Leaguer'=>'',
'CheckInDate'=>'2012-11-29',
'CheckOutDate'=>'2012-11-30',
'Page'=>'5',
);
$result = $client->GetHotelList($arr);
print_r($result);
}
catch(SoapFault $fault){
echo "Fault!code:".$fault->faultcode." string:".$fault->faultstring;
}
?>
请教如何解决, 不胜感激.
愤怒的小土豆
12 years, 3 months ago
Answers
<?php
try{
$client = new SoapClient(null,array('location'=>"http://etshotel.ziyou.com.cn/ETSHotelService.asmx?WSDL",'uri'=>"http://hotel.webservice.ets/",'SOAPAction'=>"http://hotel.webservice.ets/GetHotelList"));
$arr=array(
'Leaguer'=>'',
'CheckInDate'=>'2012-11-29',
'CheckOutDate'=>'2012-11-30',
'Page'=>'5',
);
$result = $client->__soapCall("GetHotelList", $arr, array(
'soapaction' => 'http://hotel.webservice.ets/GetHotelList',
));
print_r($result);
}
catch(SoapFault $fault){
echo "Fault!code:".$fault->faultcode." string:".$fault->faultstring;
}
中国人名很行
answered 12 years, 3 months ago