|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (C) 2013-2016 |
|
4
|
|
|
* Piotr Olaszewski <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
8
|
|
|
* in the Software without restriction, including without limitation the rights |
|
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
11
|
|
|
* furnished to do so, subject to the following conditions: |
|
12
|
|
|
* |
|
13
|
|
|
* The above copyright notice and this permission notice shall be included in |
|
14
|
|
|
* all copies or substantial portions of the Software. |
|
15
|
|
|
* |
|
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
22
|
|
|
* SOFTWARE. |
|
23
|
|
|
*/ |
|
24
|
|
|
use WSDL\Annotation\BindingType; |
|
25
|
|
|
use WSDL\Annotation\SoapBinding; |
|
26
|
|
|
use WSDL\Builder\WSDLBuilder; |
|
27
|
|
|
use WSDL\WSDL; |
|
28
|
|
|
|
|
29
|
|
|
require_once '../../vendor/autoload.php'; |
|
30
|
|
|
require_once '../ExampleService.php'; |
|
31
|
|
|
require_once '../MethodsProvider.php'; |
|
32
|
|
|
|
|
33
|
|
|
ini_set("soap.wsdl_cache_enabled", 0); |
|
34
|
|
|
|
|
35
|
|
|
$builder = WSDLBuilder::instance() |
|
36
|
|
|
->setName('DocumentLiteralService') |
|
37
|
|
|
->setTargetNamespace('http://foo.bar/documentliteralservice') |
|
38
|
|
|
->setNs('http://foo.bar/documentliteralservice/types') |
|
39
|
|
|
->setLocation('http://localhost:7777/wsdl-creator/examples/document_literal/service.php') |
|
40
|
|
|
->setStyle(SoapBinding::DOCUMENT) |
|
41
|
|
|
->setUse(SoapBinding::LITERAL) |
|
42
|
|
|
->setSoapVersion(BindingType::SOAP_11) |
|
43
|
|
|
->setMethods(MethodsProvider::get()); |
|
44
|
|
|
|
|
45
|
|
|
$wsdl = WSDL::fromBuilder($builder); |
|
46
|
|
|
|
|
47
|
|
|
if (isset($_GET['wsdl'])) { |
|
48
|
|
|
header("Content-Type: text/xml"); |
|
49
|
|
|
echo $wsdl->create(); |
|
50
|
|
|
exit; |
|
51
|
|
|
} |
|
52
|
|
|
$server = new SoapServer('http://localhost:7777/wsdl-creator/examples/document_literal/service.php?wsdl', [ |
|
53
|
|
|
'uri' => $builder->getTargetNamespace(), |
|
54
|
|
|
'location' => $builder->getLocation(), |
|
55
|
|
|
'style' => SOAP_DOCUMENT, |
|
56
|
|
|
'use' => SOAP_LITERAL |
|
57
|
|
|
]); |
|
58
|
|
|
$server->setClass('ExampleService'); |
|
59
|
|
|
$server->handle(); |
|
60
|
|
|
|