我正在尝试通过 SOAP 调用 Web 服务。我觉得 PHP 请求看起来不错。下面是 SOAP PHP 代码和 XML。请让我知道可能出了什么问题。从技术上讲,我不断得到对象的响应没有属性。
这是错误消息:
致命错误:未捕获的 SoapFault 异常:[Client] SOAP-ERROR: Encoding: object has no 'schema' property
$client = new SoapClient(
'Link.asmx?wsdl',
array(
'soap_version' => SOAP_1_1,
'trace' => 1,
)
);
$result = $client->OTA_VehAvailRate(
array(
'OTA_VehAvailRateRQ' => array(
'VehAvailRQCore' => array(
'VehRentalCore' => array(
'type' => 'VehicleRentalCoreType',
'PickUpLocation' => array(
'LocationCode' => 'ERLAX01',
),
'PickUpDateTime' => '2013-03-14T12:00:00',
'ReturnDateTime' => '2013-03-16T12:00:00',
'ReturnLocation' => array(
'LocationCode' => 'ERLAX01',
),
),
'VendorPrefs' => array(
'VendorPref' => array(
'Code' => '*****',
'CodeContext' => '******',
),
),
'VehPrefs' => array(
'VehPref' => array(
'Code' => 'HFG',
),
),
'RateQualifier' => array(
'PromotionCode' => '',
'RateQualifier' => '',
),
),
)
)
);
print_r($result);
这是 XML 模式。
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tns:OTA_VehAvailRate xmlns:tns="http://www.opentravel.org/OTA/2003/05" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:tnsC="http://www.w3.org/1999/xhtml" xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense" xmlns:tnsB="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AA:OTA_VehAvailRateRQ xmlns:AA="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" Version="0">
<AA:VehAvailRQCore>
<AA:VehRentalCore xs:type="AA:VehicleRentalCoreType" PickUpDateTime="2013-03-14T12:00:00" ReturnDateTime="2013-03-16T12:00:00">
<AA:PickUpLocation LocationCode="ERLAX01" />
<AA:ReturnLocation LocationCode="ERLAX01" />
</AA:VehRentalCore>
<AA:VendorPrefs>
<AA:VendorPref Code="****" CodeContext="******" />
</AA:VendorPrefs>
<AA:VehPrefs>
<AA:VehPref Code="HEG" />
</AA:VehPrefs>
<AA:RateQualifier PromotionCode="" RateQualifier="" />
</AA:VehAvailRQCore>
</AA:OTA_VehAvailRateRQ>
</tns:OTA_VehAvailRate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
请让我知道我做错了什么。多谢
POST /OTA2011A/OTASrvc.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.opentravel.org/OTA/2003/05/OTA_VehAvailRate"
<?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>
<OTA_VehAvailRate xmlns="http://www.opentravel.org/OTA/2003/05">
<OTA_VehAvailRateRQ>
<xsd:schema>schema</xsd:schema>xml</OTA_VehAvailRateRQ>
</OTA_VehAvailRate>
</soap:Body>
</soap:Envelope>