MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
class.phpwsdlproxy.php
Ir para a documentação deste ficheiro.
1
<?php
2
3
/*
4
PhpWsdl - Generate WSDL from PHP
5
Copyright (C) 2011 Andreas Zimmermann, wan24.de
6
7
This program is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free Software
9
Foundation; either version 3 of the License, or (at your option) any later
10
version.
11
12
This program is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License along with
17
this program; if not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
if
(basename($_SERVER[
'SCRIPT_FILENAME'
])==basename(__FILE__))
21
exit;
22
23
// This proxy can handle missing parameters with NULL values. This will only
24
// work, if the PhpWsdl class doesn't promote the WSDL to the SoapServer. But
25
// then returning complex types won't be easy anymore: You have to encode the
26
// return value with PHPs SoapVar object by yourself.
27
28
class
PhpWsdlProxy
{
29
public
function
__call
($method,$param){
30
if
(
PhpWsdl::$Debugging
)
31
PhpWsdl::Debug
(
'Proxy call method '
.$method.
': '
.print_r($param,
true
));
32
PhpWsdl::$ProxyServer
->CreateWsdl();
33
$m=
PhpWsdl::$ProxyServer
->GetMethod($method);
34
if
(is_null($m))
35
throw
(
new
SoapFault(
'MissingMethod'
,
'Method "'
.$method.
'" not found'
));
36
// Try to fix the missing parameters issue if the SoapServer is not running in WSDL mode
37
if
(!
PhpWsdl::$UseProxyWsdl
){
38
$pLen=
sizeof
($m->Param);
39
$temp=
sizeof
($param);
40
if
($pLen!=$temp){
41
PhpWsdl::Debug
(
'Wrong parameter count ('
.$temp.
'/'
.$pLen.
')'
);
42
$req=
new
DOMDocument();
43
if
($req->loadXml(file_get_contents(
'php://input'
))){
44
$x=
new
DOMXPath($req);
45
$temp=$param;
46
$param=Array();
47
$pos=0;
// Current index in the received parameter array
48
$i=-1;
49
while
(++$i<$pLen){
50
$p=$m->Param[$i];
51
if
($x->query(
"/*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='"
.$m->Name.
"']/*[local-name()='"
.$p->Name.
"']"
)->length>0){
52
PhpWsdl::Debug
(
'Parameter "'
.$p->Name.
'" was received'
);
53
$param[]=$temp[$pos];
54
$pos++;
55
}
else
{
56
PhpWsdl::Debug
(
'Parameter "'
.$p->Name.
'" was missing'
);
57
$param[]=
null
;
58
}
59
}
60
}
else
{
61
PhpWsdl::Debug
(
'Could not parse SOAP request XML'
);
62
}
63
}
64
}
65
// Prepare the method call
66
$call=($m->IsGlobal)
67
?$method
// Global method
68
:Array(
// Class method
69
PhpWsdl::$ProxyObject
,
70
$method
71
);
72
// Call the target method and return the response
73
PhpWsdl::Debug
(
'Call the target method'
);
74
return
(
sizeof
($param)<1)
75
?call_user_func(
76
$call
77
)
78
:call_user_func_array(
79
$call,
80
$param
81
);
82
}
83
}
PhpWsdlProxy
Definição
class.phpwsdlproxy.php:28
PhpWsdlProxy\__call
__call($method, $param)
Definição
class.phpwsdlproxy.php:29
PhpWsdl\Debug
static Debug($str)
Definição
class.phpwsdl.php:2399
PhpWsdl\$ProxyObject
static $ProxyObject
Definição
class.phpwsdl.php:82
PhpWsdl\$Debugging
static $Debugging
Definição
class.phpwsdl.php:376
PhpWsdl\$UseProxyWsdl
static $UseProxyWsdl
Definição
class.phpwsdl.php:94
PhpWsdl\$ProxyServer
static $ProxyServer
Definição
class.phpwsdl.php:88
classes
contrib
phpWsdl
class.phpwsdlproxy.php
Gerado por
1.10.0