forked from mikaelcom/WsdlToPhp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
samples-generator.php
143 lines (143 loc) · 5.76 KB
/
samples-generator.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/**
* Sample to show how to use WsdlToPhp class
* @package WsdlToPhpGenerator
* @date 01/07/2012
*/
ini_set('display_errors',true);
error_reporting(-1);
ini_set('memory_limit',-1);
/**
* In case function lcfirst doesn't exist
*/
if(!function_exists('lcfirst'))
{
function lcfirst($_s)
{
return strtolower(substr($_s,0,1)) . substr($_s,1);
}
}
/**
* Librairies
*/
$localDir = dirname(__FILE__) . '/';
require_once $localDir . 'Base/src/struct.php';
require_once $localDir . 'PhpGenerator/src/php_generator.php';
require_once $localDir . 'PhpGenerator/src/structs/php_generator_return_data.php';
require_once $localDir . 'PhpGenerator/src/structs/php_generator_parameter.php';
require_once $localDir . 'WsdlToPhpModel.php';
require_once $localDir . 'WsdlToPhpStruct.php';
require_once $localDir . 'WsdlToPhpService.php';
require_once $localDir . 'WsdlToPhpFunction.php';
require_once $localDir . 'WsdlToPhpGenerator.php';
require_once $localDir . 'WsdlToPhpStructValue.php';
require_once $localDir . 'WsdlToPhpStructAttribute.php';
/**
* Cleaning tests
*/
if(false)
{
echo "\r\n Clean Name for '2And'is-go54 83od+*/you=yèçés_3' is " . WsdlToPhpModel::cleanString("2And'is-go54 83od+*/you=yéçès_3") . " \r\n";
return;
}
/**
* OVH SOAP API
* Lots of structs and operations
*/
if(false)
{
$w = new WsdlToPhpGenerator('http://www.ovh.com/soapi/soapi-dlw-1.54.wsdl');
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
WsdlToPhpGenerator::setOptionResponseAsWsdlObject(true);
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
$w->generateClasses('ovh',dirname(__FILE__) . '/samples/ovh/');
}
/**
* BING Web Search API
*/
if(false)
{
$w = new WsdlToPhpGenerator('http://api.bing.net/search.wsdl');
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
WsdlToPhpGenerator::setOptionSendParametersAsArray(true);
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
$w->generateClasses('bing',dirname(__FILE__) . '/samples/bing/');
}
/**
* AT Internet
*/
if(false)
{
exec('rm -rf ' . __DIR__ . '/samples/at/*;');
$w = new WsdlToPhpGenerator('http://api.atinternet-solutions.com/toolbox/reporting.asmx?WSDL');
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
WsdlToPhpGenerator::setOptionSendArrayAsParameter(true);
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
$w->generateClasses('at',dirname(__FILE__) . '/samples/at/');
}
/**
* Via michelin
*/
if(false)
{
$wsdls = array(
'Geocoding'=>'http://webservices.viamichelin.com/ws2/services/Geocoding?wsdl',
'ReverseGeocoding'=>'http://webservices.viamichelin.com/ws2/services/ReverseGeocoding?wsdl',
'RouteCalculation'=>'http://webservices.viamichelin.com/ws2/services/RouteCalculation?wsdl',
'FindPOI'=>'http://webservices.viamichelin.com/ws2/services/FindPOI?wsdl',
'DistanceCalculation'=>'http://webservices.viamichelin.com/ws2/services/DistanceCalculation?wsdl',
'MapManagement'=>'http://webservices.viamichelin.com/ws2/services/MapManagement?wsdl',
'AccessManagement'=>'https://webservices.viamichelin.com/ws2/services/AccessManagement?wsdl');
foreach($wsdls as $name=>$wsdl)
{
$name = 'ViaMichelin' . $name;
exec('rm -rf ' . __DIR__ . '/samples/' . $name . '/*;');
$w = new WsdlToPhpGenerator($wsdl);
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
WsdlToPhpGenerator::setOptionResponseAsWsdlObject(true);
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
WsdlToPhpGenerator::setOptionSendArrayAsParameter(false);
WsdlToPhpGenerator::setOptionSendParametersAsArray(false);
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
$w->generateClasses($name,dirname(__FILE__) . '/samples/' . $name . '/');
}
}
/**
* Any
*/
if(true)
{
$name = 'mobilefish';
$wsdl = 'http://www.mobilefish.com/services/web_service/countries.php?wsdl';
exec('rm -rf ' . __DIR__ . '/samples/' . $name . '/*;');
echo "\r\nStart at " . date('H:i:s');
$w = new WsdlToPhpGenerator($wsdl);
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
WsdlToPhpGenerator::setOptionResponseAsWsdlObject(true);
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
WsdlToPhpGenerator::setOptionSendArrayAsParameter(false);
WsdlToPhpGenerator::setOptionSendParametersAsArray(false);
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
echo "\r\nStart generation at " . date('H:i:s');
$w->generateClasses($name,dirname(__FILE__) . '/samples/' . $name . '/');
echo "\r\nEnd generation at " . date('H:i:s');
echo "\r\nGenerate doc start " . date('H:i:s');
$ouputs = array();
exec('rm -rf ' . __DIR__ . '/docs/' . $name . '/* && clear && phpdoc --sourcecode on -d ' . __DIR__ . '/samples/' . $name . ' -t ' . __DIR__ . '/docs/' . $name . ' -pp -ti "' . ucfirst($name) . ' package documentation" -o HTML:frames:DOM/earthli;',$ouputs);
print_r($ouputs);
echo "\r\nGenerate doc end " . date('H:i:s');
}
?>