很抱歉不得不这样做,但我没有得到运行这个特定网络服务的人的喜爱。我以前从未使用过 SOAP。
Here's the method I'm trying to call
这是我认为应该有效的代码
public function soapTest(){
echo "start <br />";
use_soap_error_handler(true);
$client = new SoapClient("https://cwi.rezexchange.com:9991/?wsdl");
// here's the problem. What goes in the parenthesis?
$result = $client->CwiRateDetails(????);
echo($result);
echo "<br /> end";
}
现在我猜这告诉我括号应该包含什么。
POST /Service.asmx HTTP/1.1
Host: cwi.rezexchange.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://hotelconcepts.com/CwiRateDetails"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CwiRateDetails xmlns="http://hotelconcepts.com/">
<PropertyCode>string</PropertyCode>
<DateFrom>dateTime</DateFrom>
<DateTo>dateTime</DateTo>
<RatePlan>string</RatePlan>
<RoomType>string</RoomType>
<PromotionalRates>boolean</PromotionalRates>
</CwiRateDetails>
</soap:Body>
</soap:Envelope>
我的猜测是这样的
$result = $client->CwiRateDetails($PCode, $DateFrom, $DateTo, $RatePlan, $RoomType, false);
应该可以。但我不知道日期格式是什么,或者房间类型是什么,或者如何引用房价计划。
现在。在我通过电子邮件与他们发疯之前,我是否错误地认为他们需要向我提供更多信息?或者我可以使用某种 SOAP 技巧从某处获取该信息?最佳答案
尝试
$result = $client->CwiRateDetails(array(
'PropertyCode' => ...,
'DateFrom' => ...,
'DateTo' => ...,
'RatePlan' => ...,
'RoomType' => ...,
'PromotionalRates' => ...,
));
您必须根据 XML 序列化 DateFrom
和 DateTo
中的日期时间值以及 PromotionalRates
中的 bool 值架构规范:
关于php - 使用 PHP 调用特定服务的 SOAP 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/777346/