MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
demo3.php
Ir para a documentação deste ficheiro.
1
<?php
2
3
// This demonstrates how I get around a really nasty problem: If the
4
// SOAP client won't send a parameter when the value is NULL, the
5
// SoapServer will fail with "Missing parameter" when giving the WSDL
6
// in the first parameter of the SoapServer constructor. If you give
7
// NULL as first parameter to the SoapServer constructor, your method
8
// will be called with a wrong parameter order.
9
//
10
// With the PhpWsdlProxy class I try to get around the problem, but
11
// complex type return values must be returned with PHPs SoapVar
12
// object then. Primitive return types like string, int or boolean don't
13
// need a special handling.
14
// To get rid of the NULL problem you need to ensure that the PHP
15
// SoapServer has no knowledge of the WSDL. To ensure this, set the
16
// PhpWsdl::$UseProxyWsdl property to FALSE (is FALSE per default).
17
//
18
// If you want to mix class and global methods, you need to use the proxy.
19
20
// Include the demonstration classes
21
require_once(
'class.soapdemo.php'
);
22
require_once(
'class.complextypedemo.php'
);
23
24
// Initialize the PhpWsdl class
25
require_once(
'class.phpwsdl.php'
);
26
PhpWsdl::$UseProxyWsdl
=
true
;
// Comment this line out to get rid of "Missing parameter" exceptions
27
$soap
=
PhpWsdl::CreateInstance
(
28
null
,
// PhpWsdl will determine a good namespace
29
null
,
// Change this to your SOAP endpoint URI (or keep it NULL and PhpWsdl will determine it)
30
'./cache'
,
// Change this to a folder with write access
31
Array(
// All files with WSDL definitions in comments
32
'class.soapdemo.php'
,
33
'class.complextypedemo.php'
,
34
__FILE__
// To include the global method example at the end of this file
35
),
36
null
,
// The name of the class that serves the webservice will be determined by PhpWsdl
37
null
,
// This demo contains all method definitions in comments
38
null
,
// This demo contains all complex types in comments
39
false
,
// Don't send WSDL right now
40
false
);
// Don't start the SOAP server right now
41
42
// Disable caching for demonstration
43
ini_set(
'soap.wsdl_cache_enabled'
,0);
// Disable caching in PHP
44
PhpWsdl::$CacheTime
=0;
// Disable caching in PhpWsdl
45
46
// Run the SOAP server
47
if
(
$soap
->IsWsdlRequested())
48
$soap
->Optimize=
false
;
// Don't optimize WSDL to send it human readable to the browser
49
$soap
->RunServer(
// Finally, run the server and enable the proxy
50
null
,
51
Array(
// Use an array for this parameter to enable the proxy:
52
'SoapDemo'
,
// The name of the target class that will handle SOAP requests
53
new
SoapDemo
()
// An instance of the target class that will handle SOAP requests
54
)
55
);
56
63
function
GlobalMethodDemo
(){
64
return
utf8_encode(
'Response of the global method demo'
);
65
}
66
67
// If you want PhpWsdl to handle all methods as global per default, set the
68
// PhpWsdlMethod::$IsGlobalDefault to TRUE. Then you don't need to set the
69
// setting "global" to "1" for every method.
PhpWsdl\$CacheTime
static $CacheTime
Definição
class.phpwsdl.php:256
PhpWsdl\CreateInstance
static CreateInstance( $nameSpace=null, $endPoint=null, $cacheFolder=null, $file=null, $name=null, $methods=null, $types=null, $outputOnRequest=false, $runServer=false)
Definição
class.phpwsdl.php:532
PhpWsdl\$UseProxyWsdl
static $UseProxyWsdl
Definição
class.phpwsdl.php:94
SoapDemo
Definição
class.soapdemo.php:11
GlobalMethodDemo
GlobalMethodDemo()
Definição
demo3.php:63
$soap
$soap
Definição
demo3.php:27
classes
contrib
phpWsdl
demo3.php
Gerado por
1.10.0