1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
soapclient.php
См. документацию.
1
<?php
2
3
class
CSOAPClient
4
{
6
var
$Server
;
8
var
$Path
;
10
var
$Port
;
12
var
$Timeout
= 0;
14
var
$Login
;
16
var
$Password
;
17
18
var
$SOAPRawRequest
;
19
var
$SOAPRawResponse
;
20
21
public
function
__construct
( $server,
$path
=
'/'
, $port = 80 )
22
{
23
$this->Login =
""
;
24
$this->Password =
""
;
25
$this->Server = $server;
26
$this->Path =
$path
;
27
$this->Port = $port;
28
if
( is_numeric( $port ) )
29
$this->Port = $port;
30
elseif
(mb_strtolower($port) ==
'ssl'
)
31
$this->Port = 443;
32
else
33
$this->Port = 80;
34
}
35
39
function
send
(
$request
)
40
{
41
$fullUrl = ($this->Port == 443 ?
"https"
:
"http"
).
"://"
.$this->Server.
":"
.$this->Port.$this->Path;
42
43
$uri
= new \Bitrix\Main\Web\Uri($fullUrl);
44
if
(
$uri
->getHost() ==
''
)
45
{
46
$this->ErrorString =
'<b>Error:</b> CSOAPClient::send() : Wrong server parameters.'
;
47
return
0;
48
}
49
else
50
{
51
$this->Server =
$uri
->getHost();
52
$this->Port =
$uri
->getPort();
53
$this->Path =
$uri
->getPathQuery();
54
}
55
56
if
( $this->Timeout != 0 )
57
{
58
$fp = fsockopen( $this->Server,
59
$this->Port,
60
$this->errorNumber,
61
$this->errorString,
62
$this->Timeout );
63
}
64
else
65
{
66
$fp = fsockopen( $this->Server,
67
$this->Port,
68
$this->errorNumber,
69
$this->errorString );
70
}
71
72
if
( $fp == 0 )
73
{
74
$this->ErrorString =
'<b>Error:</b> CSOAPClient::send() : Unable to open connection to '
. $this->Server .
'.'
;
75
return
0;
76
}
77
78
$payload =
$request
->payload();
79
80
$authentification =
""
;
81
if
( ( $this->
login
() !=
""
) )
82
{
83
$authentification =
"Authorization: Basic "
. base64_encode( $this->
login
() .
":"
. $this->
password
() ) .
"\r\n"
;
84
}
85
86
$name
=
$request
->name();
87
$namespace =
$request
->get_namespace();
88
if
($namespace[mb_strlen($namespace) - 1] !=
"/"
)
89
$namespace .=
"/"
;
90
91
$HTTPRequest =
"POST "
. $this->Path .
" HTTP/1.0\r\n"
.
92
"User-Agent: BITRIX SOAP Client\r\n"
.
93
"Host: "
. $this->Server .
"\r\n"
.
94
$authentification .
95
"Content-Type: text/xml; charset=utf-8\r\n"
.
96
"SOAPAction: \""
. $namespace .
$request
->name() .
"\"\r\n"
.
97
"Content-Length: "
. strlen($payload) .
"\r\n\r\n"
.
98
$payload;
99
100
$this->SOAPRawRequest = $HTTPRequest;
101
if
( !fwrite( $fp, $HTTPRequest
/*, strlen( $HTTPRequest )*/
) )
102
{
103
$this->ErrorString =
"<b>Error:</b> could not send the SOAP request. Could not write to the socket."
;
104
$response
= 0;
105
return
$response
;
106
}
107
108
$rawResponse =
""
;
109
// fetch the SOAP response
110
while
(
$data
= fread( $fp, 32768 ) )
111
{
112
$rawResponse .=
$data
;
113
}
114
115
// close the socket
116
fclose( $fp );
117
118
$this->SOAPRawResponse = $rawResponse;
119
$response
=
new
CSOAPResponse
();
120
$response
->decodeStream(
$request
, $rawResponse );
121
return
$response
;
122
}
123
124
function
setTimeout
( $timeout )
125
{
126
$this->Timeout = $timeout;
127
}
128
129
function
setLogin
(
$login
)
130
{
131
$this->Login =
$login
;
132
}
133
134
function
getRawRequest
()
135
{
136
return
$this->SOAPRawRequest
;
137
}
138
139
function
getRawResponse
()
140
{
141
return
$this->SOAPRawResponse
;
142
}
143
144
function
login
()
145
{
146
return
$this->Login
;
147
}
148
149
function
setPassword
(
$password
)
150
{
151
$this->Password =
$password
;
152
}
153
154
function
password
()
155
{
156
return
$this->Password
;
157
}
158
}
159
160
?>
$path
$path
Определения
access_edit.php:21
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
$login
$login
Определения
change_password.php:8
CSOAPClient
Определения
soapclient.php:4
CSOAPClient\setLogin
setLogin( $login)
Определения
soapclient.php:129
CSOAPClient\__construct
__construct( $server, $path='/', $port=80)
Определения
soapclient.php:21
CSOAPClient\$Port
$Port
The port of the server to communicate with.
Определения
soapclient.php:10
CSOAPClient\$SOAPRawResponse
$SOAPRawResponse
Определения
soapclient.php:19
CSOAPClient\setTimeout
setTimeout( $timeout)
Определения
soapclient.php:124
CSOAPClient\login
login()
Определения
soapclient.php:144
CSOAPClient\getRawRequest
getRawRequest()
Определения
soapclient.php:134
CSOAPClient\send
send( $request)
Определения
soapclient.php:39
CSOAPClient\$Timeout
$Timeout
How long to wait for the call.
Определения
soapclient.php:12
CSOAPClient\getRawResponse
getRawResponse()
Определения
soapclient.php:139
CSOAPClient\setPassword
setPassword( $password)
Определения
soapclient.php:149
CSOAPClient\$SOAPRawRequest
$SOAPRawRequest
Определения
soapclient.php:18
CSOAPClient\$Password
$Password
HTTP password for HTTP authentification.
Определения
soapclient.php:16
CSOAPClient\$Server
$Server
The name or IP of the server to communicate with.
Определения
soapclient.php:6
CSOAPClient\$Login
$Login
HTTP login for HTTP authentification.
Определения
soapclient.php:14
CSOAPClient\password
password()
Определения
soapclient.php:154
CSOAPClient\$Path
$Path
The path to the SOAP server.
Определения
soapclient.php:8
CSOAPResponse
Определения
soapresponse.php:4
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
$uri
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения
urlrewrite.php:61
$name
$name
Определения
menu_edit.php:35
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$password
$password
Определения
result.php:7
$response
$response
Определения
result.php:21
bitrix
modules
webservice
classes
general
soap
soapclient.php
Создано системой
1.14.0