I am wrote the coding for PHP 5 to access tourico holidays webservice. as follows.But it returns the error followed by the code .please help me
- <?php
-
try{
-
class authentication_header
-
{
-
private $username;
-
private $password;
-
private $culture;
-
private $version;
-
-
public function __construct($username,$password,$culture,$version)
-
{
-
$this->username=$username;
-
$this->password=$password;
-
$this->culture=$culture;
-
$this->version=$version;
-
}
-
}
-
-
$wsdl = 'http://demo.touricoholidays.com/ws/HotelsService.asmx?WSDL';
-
$client = new SOAPClient($wsdl,array('trace'=> true));
-
-
$parameter = array('sDestination' => 'NYC',
-
'sHotelCityName' => '',
-
'sHotelLocationName' => '',
-
'sHotelName' => '',
-
'dtCheckIn' => '2007-11-20',
-
'dtCheckOut' => '2007-12-01',
-
'roomsInformation' => $roominfo,
-
'maxPrice' => 0,
-
'starLevel' => 2,
-
'fAvailableOnly' => 1);
-
-
$auth=new authentication_header('yanivy','111111','en_US','5.5');
-
-
$authvalues=new SoapVar($auth,SOAP_ENC_OBJECT,'LoginHeader');
-
-
$header=new SoapHeader("myURN","LoginHeader",$authvalues,false,"http://schemas.xmlsoap.org/soap/actor/next");
-
-
$client->__call('SearchHotels', $parameter, null, $header);
-
}
-
catch(SOAPFault $f)
-
{
-
echo "<pre>";
-
print $f;
-
echo "</pre>";
-
}
-
?>
Error:
-----------------------------------------------------------------------
SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> TravelService.CustomException.LoginFailedException : Login failed. Check username and password.
at TravelService.BaseAuthService.ValidateLoginHeader( LoginHeader loginHeader, Boolean isCultureMandatory, Boolean isVersionMandatory, Boolean isAmendment)
at TravelService.BaseAuthService.Authenticate(Boolean isCultureMandatory, Boolean isVersionMandatory, Boolean isAmendment)
at TravelService.BaseAuthService.Authenticate()
at TravelService.HotelsService.SearchHotels(String sDestination, String sHotelCityName, String sHotelLocationName, String sHotelName, DateTime dtCheckIn, DateTime dtCheckOut, RoomInfo[] roomsInformation, Decimal maxPrice, Decimal starLevel, Boolean fAvailableOnly)
--- End of inner exception stack trace --- in F:\xampp\htdocs\ico\mydemo2.php:39
Stack trace:
#0 F:\xampp\htdocs\ico\mydemo2.php(39): SoapClient->__call('SearchHotels', Array, NULL, Object(SoapHeader))
#1 {main}
-------------------------------------------------
Please Help me to solve the error