Re: [SOAP] error while passing soap header

[email protected] (Jamesas)
Newsgroups php.soap
Message-ID <[email protected]>
Thank you for your reply.Now it working.Thanks a lot.

James.S



Jeffery Fernandez-3 wrote:
> 
> On Thursday 25 October 2007 00:49, Jamesas wrote:
>>         error_reporting(E_ALL);
>>         
>>         $ini = ini_set("soap.wsdl_cache_enabled","0");
>>
>>         //set up the service client using WSDL
> 
> <!-- SNIP -->
> 
> You hade the namespace for the SoapHeader set wrong. Here is a working
> version:
> 
> <?php
> 
> error_reporting(E_ALL);
> $ini = ini_set("soap.wsdl_cache_enabled","0");
> 
> 
> try {
> 	//set up the service client using WSDL
> 	echo "Connecting to server using WSDL<br />";
> 	
> 	$client = new
> SoapClient("http://demo.touricoholidays.com/ws/HotelsService.asmx?WSDL",
> array("trace" => true, "exceptions" => true, 'soap_version' => SOAP_1_1));
> 	
> 	
> 	//var_dump($client->__getFunctions());
> 	//var_dump($client->__getTypes());
> 	
> 	$x["username"]="ofstays";
> 	$x["password"]="111111";
> 	$x["culture"]="en_US";
> 	$x["version"]='4.5';
> 	
> 	//$x = new SoapVar($x, SOAP_ENC_OBJECT,
> "AuthenticationHeader","http://www.itworks.nl/");
> 	$header=new SoapHeader('http://tourico.com/webservices/','LoginHeader',
> $x);
> 	
> 	$client->__setSoapHeaders(array($header));
> 	echo "SoapHeaders set sucessfully<br />";
> 	
> 	
> 	//$roominfo = array('AdultsNum' => 1,'ChildNum' => 1,'ChildAges' => 8);
> 	$parameter = array(
> 		'sDestination' => 'NYC',
> 		'sHotelCityName' => '',
> 		'sHotelLocationName' => '',
> 		'sHotelName' => '',
> 		'dtCheckIn' => '2007-11-20',
> 		'dtCheckOut' => '2007-12-01',
> 		'roomsInformation' => array('RoomInfo' => array('AdultsNum' => 1,
> 'ChildNum' => 1, 'ChildAges' => array('ChildAge' => 8))),
> 		'maxPrice' => 0,
> 		'starLevel' => 2,
> 		'fAvailableOnly' => 1
> 	);
> 	
> 	//$result2 = $client->__soapCall('Hello',$params2,
> NULL,$header,$output_headers);
> 	
> 	$result = $client->SearchHotels($parameter);
> 	
> 	
> 	echo("<br />REQUEST :<br />" .
> htmlspecialchars($client->__getLastRequest()) . "<br />");
> 	echo("<br />RESPONSE:<br />"
> .htmlspecialchars($client->__getLastResponse()) . "<br />");
> }
> catch (SoapFault $ex)
> {
> 	echo "Error:<br />" . nl2br($ex->faultcode) . '<br /><br />Error
> Details:<br />'. nl2br($ex->faultstring) . '<br />';
> 	
> 	echo("<br />REQUEST :<br />" .
> htmlspecialchars($client->__getLastRequest()) . "<br />");
> 	echo("<br />RESPONSE:<br />"
> .htmlspecialchars($client->__getLastResponse()) . "<br />");	
> }
> 
> ?>
> 
> 
> cheers,
> Jeffery
> -- 
> Internet Vision Technologies
> Level 1, 520 Dorset Road
> Croydon
> Victoria - 3136
> Australia
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/error-while-passing-soap-header-tf4684062.html#a13400198
Sent from the Php - Soap mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.