我通过发送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());
我浪费了很多天。甚至在支持下询问但没有找到帮助。