//PHP CODE
<?php
$xmlData='<OTA_HotelDestinationsRQ Version="1.0">
<POS>
<Source>
<UniqueId Id="user:password" />
</Source>
</POS>
<DestinationInformation LanguageCode="EN" />
</OTA_HotelDestinationsRQ>';
$wsdl="http://acceptance.travelstreet.com/hotelsv3/components/Hotels_DestinationsWS.cfc?wsdl";
$client=new SoapClient($wsdl,array('trace' => 1));
try
{
$res=$client->__call("OTA_HotelDestinationsRQ",array($xmlData));
}
catch (SoapFault $Exception)
{
echo 'SoapFault Exception';
}
echo $res;
?>
It is showing Internal Server error
Later on i have changed above xml into array using xml2array class and i kept the result in one variable like
$iArray=xml2array($xmlData);
Using this i have coded like:
<?php
$xmlData='<OTA_HotelDestinationsRQ Version="1.0">
<POS>
<Source>
<UniqueId Id="user:password" />
</Source>
</POS>
<DestinationInformation LanguageCode="EN" />
</OTA_HotelDestinationsRQ>';
$wsdl="http://acceptance.travelstreet.com/hotelsv3/components/Hotels_DestinationsWS.cfc?wsdl";
$client=new SoapClient($wsdl,array('trace' => 1));
try
{
$res=$client->__call("OTA_HotelDestinationsRQ",$iArray);
// (or) also check with bellow st开发者_JS百科atement
$res=$client->OTA_HotelDestinationsRQ($iArray);
}
catch (SoapFault $Exception)
{
echo 'SoapFault Exception';
}
echo $res;
?>
It is showing Invalid Xml error
Hi I was getting same kind of error but then @Pete here , helped me with this code snippet , please try to use this code snippet may be it can work for you as well..
<?php
$xmlData='<OTA_HotelDestinationsRQ Version="1.0">
<POS>
<Source>
<UniqueId Id="user:password" />
</Source>
</POS>
<DestinationInformation LanguageCode="EN" />
</OTA_HotelDestinationsRQ>';
$client = new SOAPClient(
'http://acceptance.travelstreet.com/hotelsv3/components/Hotels_DestinationsWS.cfc?wsdl',
array(
'location' => 'http://acceptance.travelstreet.com/hotelsv3/components/Hotels_DestinationsWS.cfc',
'trace' => 1,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
)
);
$result = array();
$params = array("YourXMLParameterName" => $request);
try
{
$result = $client->__soapCall('getAllDepartments', array("parameters"=>$params));
}
catch (SoapFault $Exception)
{
echo "SOAP Fault: ".$e->getMessage()."<br />\n";
}
echo $res;
?>
精彩评论