<?php

/*//define("SERVICE_WSDL", "http://elecdistributiongearcctradingasefficientdata.dedicated.co.za/service.asmx?wsdl");
define("SERVICE_WSDL", "http://localhost:61460/Service.asmx?wsdl");

class SoapProxy {
		// Singleton instance
		private static $instance;
		
		public function __construct() {
			
			// Create a new SoapClient (see: http://se2.php.net/soap)
			$this->webService = new SoapClient(
				SERVICE_WSDL,
				array(
					"trace" => 1,
					"exceptions" => 1
				) 
			);
		}
		
		public function login($username,$password)
		{
			$p = new stdClass();
			$p->username = $username;
			$p->password = $password;
			$strXml = $this->webService->login2($p)->login2Result;
			echo json_encode($strXml);
		}
}
*/

include("../lib/util.php");
include("soap.php");

extract($_GET);
$parameters = "";
foreach($_GET as $key=>$value)
{
	$parameters .= "$key=$value&";
}
if(!isset($action))die();


switch(strtoupper($action))
{
	case "CLIENTDEPENDANT":
	case "CLIENTPRODUCT":
	case "GETCLIENTS":
	case "LOGIN":
	{
		$proxy = new SoapProxy();
		$p = new stdClass();
		$p->pars = "$parameters";
		$p->url = "http://41.76.212.26/pjd/service.php";
		//$p->debtor_id = $debtor_id;
		$url ="";
		//var_dump($p);
		//die();
		$strXml = $proxy->webService->RunIt($p)->RunItResult;
		//var_dump($proxy->webService->GetDebtorCompany($p));
		echo $strXml;
		break;
	}
}




function getkey()
{
	$proxy = new SoapProxy();
	$p = new stdClass();
	$p->vendorID = "2";
	$strXml = $proxy->webService->iSkhiya($p)->iSkhiyaResult;
	$resarray = (json_decode(json_encode($strXml),true));
	return $resarray;
}

?>