我試圖通過SOAP調用Web服務。我覺得PHP請求看起來是正確的。以下是SOAP PHP代碼和XML。請讓我知道可能是錯的。我在技術上不斷得到對象的迴應沒有財產。SOAP PHP問題「編碼:對象沒有'模式'屬性」
這是錯誤消息:
Fatal error: Uncaught SoapFault exception: [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>
您可能會錯過規範中的某些內容,也許您需要傳遞模式屬性或類似內容。 – silkfire 2013-02-19 16:59:54
也共享架構。 – SparKot 2013-02-19 19:15:24
此錯誤通常是由錯誤順序傳遞元素引起的。 – EmmyS 2013-02-19 19:43:12