1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (C) 2013-2020 |
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
|
|
|
namespace WSDL\XML\XMLUse; |
25
|
|
|
|
26
|
|
|
use DOMDocument; |
27
|
|
|
use DOMElement; |
28
|
|
|
use WSDL\Builder\Parameter; |
29
|
|
|
use WSDL\XML\XMLAttributeHelper; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* XMLLiteralUse |
33
|
|
|
* |
34
|
|
|
* @author Piotr Olaszewski <[email protected]> |
35
|
|
|
*/ |
36
|
|
|
class XMLLiteralUse implements XMLUse |
37
|
|
|
{ |
38
|
|
|
public function generateSoapBody(DOMDocument $DOMDocument, string $targetNamespace, string $soapVersion): DOMElement |
39
|
|
|
{ |
40
|
2 |
|
return XMLAttributeHelper::forDOM($DOMDocument) |
41
|
|
|
->createElementWithAttributes($soapVersion . ':body', [ |
42
|
2 |
|
'use' => 'literal', |
43
|
2 |
|
'namespace' => $targetNamespace |
44
|
2 |
|
]); |
45
|
|
|
} |
46
|
2 |
|
|
47
|
|
|
public function generateSoapHeaderIfNeeded(DOMDocument $DOMDocument, string $targetNamespace, string $soapVersion, string $soapHeaderMessage = '', Parameter $header = null): ?DOMElement |
48
|
|
|
{ |
49
|
|
|
if ($header) { |
50
|
|
|
return XMLAttributeHelper::forDOM($DOMDocument) |
51
|
|
|
->createElementWithAttributes($soapVersion . ':header', [ |
52
|
3 |
|
'use' => 'literal', |
53
|
|
|
'namespace' => $targetNamespace, |
54
|
3 |
|
'part' => $header->getNode()->getSanitizedName(), |
55
|
2 |
|
'message' => $soapHeaderMessage |
56
|
2 |
|
]); |
57
|
2 |
|
} |
58
|
2 |
|
|
59
|
2 |
|
return null; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|