<?php
require_once('class.wsdlcache.php');
require_once('nusoap.php');

class BookLink{
	public $wsdlURL="ProdSecureLogin.wsdl";
	public $namespace="http://webservice.nada.com/";
	public $user="amwbsrvceprod";
	public $password="amwbsrvceprod";
	public $wsdl;
	public $client;
	
	public $token=NULL;
	
	function __construct(){
		$cache = new wsdlcache();
		$this->wsdl = $cache->get($this->wsdlURL);
		if ($this->wsdl == NULL) {
			$this->wsdl = new wsdl($this->wsdlURL);
			$cache->put($this->wsdl);
		}
		$this->client = new nusoap_client($this->wsdl, true);
	}
	 
	function getToken(){
		
		//$param = array('tokenRequest'=>array('Username'=>$this->user, 'Password'=>$this->password));
		//$resp = $this->client->call("getToken", array("parameters"=>$param), $this->namespace, "", false, NULL, "document", "literal");
		
		$GetTokenRequest = array('Username'=>$user, 'Password'=>$password);
	
$getToken = array('tokenRequest'=>$GetTokenRequest);
$client = new nusoap_client($this->wsdl, true);
$loginToken = $client->call("getToken", array("parameters"=>$getToken), $this->namespace, "", false, null, "document", "literal");

		echo $this->client->getError();
		print_r($loginToken);
		/*if($this->client->response!=''){ $this->token=$resp['getTokenResult']; }
		else{ $this->token=NULL; }
		
		return $this->token;*/
	}

}
?>