0

我正在通过发送 XML 请求调用 PHP SOAP 中的 Web 服务,但我不知道发生了什么我收到以下错误。虽然我已经浏览了网络但没有得到任何答案。请帮助任何人。错误如下:

soapenv:Server.userExceptionorg.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" associated with an element type "hb:getHotelValuedAvail" is not bound.

正在使用的代码如下:-

$user = "Username";
$pass = "Password";
$destino = "Test.wsdl";
$objClient = new SoapClient($destino, array('trace' => true,'exceptions' => 0, 'encoding' => 'UTF-8'));
$xml = '<hb:getHotelValuedAvail xmlns:hb="http://axis.frontend.hydra.hotelbeds.com" xsi:type="xsd:string"><HotelValuedAvailRQ echoToken="DummyEchoToken" sessionId="DummySessionId" xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd"><Language>ENG</Language><Credentials><User>'.$user.'</User><Password>'.$pass.'</Password></Credentials><PaginationData pageNumber="1" itemsPerPage="999"/><CheckInDate date="20121013"/><CheckOutDate date="20121015"/><Destination code="PMI" type="SIMPLE"/><OccupancyList><HotelOccupancy>          <RoomCount>1</RoomCount><Occupancy><AdultCount>2</AdultCount><ChildCount>0</ChildCount></Occupancy></HotelOccupancy></OccupancyList></HotelValuedAvailRQ></hb:getHotelValuedAvail>';

$soapvar = new SoapVar($xml, XSD_ANYXML);
$objResponse = $objClient->__soapCall("getHotelValuedAvail", array($soapvar)); 
print_r($objClient->__getLastResponse());

我在这上面浪费了很多天。甚至要求支持但没有找到帮助。

4

0 回答 0