-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.php
92 lines (67 loc) · 1.82 KB
/
Client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
// Request Model
class deposit
{
public $account_number;
public $money_amount;
}
class withdraw
{
public $account_number;
public $money_amount;
public $pin;
}
class transfer
{
public $account_number;
public $money_amount;
public $pin;
public $to;
}
class Client{
public $instance = NULL;
public function __construct()
{
$params = array(
'location'=>'http://localhost/SP/Server.php?wsdl',
'uri' => 'urn://localhost/SP/Server.php?wsdl',
'trace'=>1,'cache_wsdl'=>WSDL_CACHE_NONE );
$this->instance = new SoapClient(NULL, $params);
}
public function getDeposit($deposit_info)
{
return $this->instance->__soapCall('deposit_money', [$deposit_info]);
}
public function getMoney($withdraw_info)
{
return $this->instance->__soapCall('money_withdraw', [$withdraw_info]);
}
public function getTransfer($transfer_info)
{
return $this->instance->__soapCall('transfer_money', [$transfer_info]);
}
}
$client = new Client;
$deposit_info = new deposit();
$deposit_info->account_number = 1;
$deposit_info->money_amount = 4000;
$withdraw_info = new withdraw();
$withdraw_info->account_number = 1;
$withdraw_info->money_amount = 4000;
$withdraw_info->pin = '12345';
$transfer_info = new transfer();
$transfer_info->account_number = 1;
$transfer_info->to = 4;
$transfer_info->money_amount = 1000;
$transfer_info->pin = '12345';
try{
echo "Do Deposits\t: " ,$client->getDeposit($deposit_info),"\n";
echo "Money Withdraw\t: " ,$client->getMoney($withdraw_info),"\n";
echo "Money Transfer\t: " ,$client->getTransfer($transfer_info),"\n";
echo "Operation Finished\n";
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>