forked from BeSimple/BeSimpleSoapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoapResponse.php
59 lines (52 loc) · 1.54 KB
/
SoapResponse.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
<?php
/*
* This file is part of the BeSimpleSoapClient.
*
* (c) Christian Kerl <christian-kerl@web.de>
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace BeSimple\SoapServer;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapMessage;
/**
* SoapResponse class for SoapClient. Provides factory function for response object.
*
* @author Andreas Schamberger <mail@andreass.net>
*/
class SoapResponse extends CommonSoapResponse
{
/**
* Factory function for SoapResponse.
*
* @param string $content Content
* @param string $location Location
* @param string $action SOAP action
* @param string $version SOAP version
*
* @return BeSimple\SoapClient\SoapResponse
*/
public static function create($content, $location, $action, $version)
{
$response = new SoapResponse();
$response->setContent($content);
$response->setLocation($location);
$response->setAction($action);
$response->setVersion($version);
$contentType = SoapMessage::getContentTypeForVersion($version);
$response->setContentType($contentType);
return $response;
}
/**
* Send SOAP response to client.
*/
public function send()
{
// set Content-Type header
header('Content-Type: '.$this->getContentType());
// send content to client
echo $this->getContent();
}
}