forked from drock/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
soaptest
executable file
·94 lines (71 loc) · 1.31 KB
/
soaptest
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
93
94
#!/usr/bin/env php
DRock Soap Test Utility
<?php
ini_set('display_errors','1');
try
{
$console = fopen('php://stdin','r');
$wsdl = $argv[1];
echo 'Creating soap client for: ' . $wsdl . PHP_EOL;
$client = new SoapClient($wsdl);
echo PHP_EOL;
doMainMenu();
}
catch (Exception $e)
{
echo PHP_EOL , 'ERROR: ' . (string)$e;
}
function doMainMenu()
{
global $console;
do
{
?>
What would you like to do?
1. List WSDL Methods
2. Call Method
Q. Quit
Enter Choice:
<?php
$choice = fgets($console,80);
switch(trim($choice))
{
case '1':
printSoapFunctions();
break;
case '2':
doCallMethod();
break;
case 'q':
case 'Q':
return;
}
}while(true);
}
function printSoapFunctions()
{
global $client;
$functions = $client->__getFunctions();
if(count($functions) == 0)
{
throw new Exception('No functions defined from given WSDL');
}
echo PHP_EOL . 'Available Functions:';
foreach($functions as $function)
{
echo PHP_EOL . $function;
}
echo PHP_EOL;
}
function doCallMethod()
{
global $client;
global $console;
echo PHP_EOL . 'Enter Method Call (php syntax. ex: myMethod(\'param\',1)):';
$command = trim(fgets($console,80));
$call = '$result = $client->' . $command . ';';
eval($call);
print_r($result);
var_dump($client->__getLastRequest());
}
?>