MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
webServicesServer.class
Ir para a documentação deste ficheiro.
1
<?php
2
39
class
webServicesServer
extends
SoapServer
40
{
46
protected
$log
= array();
47
53
public
function
handle
($soap_request =
null
)
54
{
55
// Obtém a função e os parâmetros passado
56
$this->setLog(
'metodo_parametro'
, file_get_contents(
'php://input'
));
57
//Variavel deprecated a partir do php 5.6
58
//$GLOBALS['HTTP_RAW_POST_DATA']
59
60
ob_end_flush();
61
ob_start();
62
63
parent::handle();
64
65
// Obtém o retorno da função executada pelo webservices
66
$this->setLog(
'retorno'
, ob_get_contents());
67
68
ob_flush();
69
70
// Registra log para o webservices executado
71
$this->registraLogDoWebServices();
72
}
73
77
private
function
registraLogDoWebServices()
78
{
79
try
80
{
81
// Executa o log apenas se existir a classe de manipulação
82
if
( file_exists(__DIR__ .
'/../../modules/basic/types/BasLogWebServices.class'
) )
83
{
84
$logWebServices =
new
BasLogWebServices();
85
$logWebServices->metodo = SAGU::NVL($this->getLogName(
'metodo'
),
'-'
);
86
$logWebServices->parametros = implode(
'; '
, $this->getLogName(
'parametros'
));
87
$logWebServices->retorno = $this->getLogName(
'retorno'
);
88
$logWebServices->save();
89
}
90
}
91
catch
( Exception $e )
92
{
93
// Para não trancar o webservices caso ocorra algum erro
94
}
95
}
96
103
private
function
getLogName($name)
104
{
105
return
$this->log[$name];
106
}
107
114
private
function
setLog($name, $value)
115
{
116
try
117
{
118
if
( $name ==
'metodo_parametro'
)
119
{
120
$xml = simplexml_load_string(str_replace(
':'
,
'-'
, $value));
121
122
foreach
( $xml as $tags )
123
{
124
$parametros = array();
125
foreach
( $tags as $key => $tag )
126
{
127
$metodo =
''
. str_replace(
'ns1-'
,
''
, $key);
128
129
foreach
( $tag as $keyParam => $parametro )
130
{
131
$parametros[] =
'$'
. $keyParam .
': '
. $parametro;
132
}
133
}
134
}
135
136
$this->log[
'metodo'
] = $metodo;
137
138
$this->log[
'parametros'
] = count($parametros) ? $parametros : NULL;
139
}
140
else
if
( $name ==
'retorno'
)
141
{
142
$xml = simplexml_load_string(str_replace(
':'
,
'-'
, $value));
143
144
foreach
( $xml as $tags )
145
{
146
foreach
( $tags as $key => $tag )
147
{
148
$retorno = $tag->faultstring ?
'ERROR: '
. $tag->faultcode .
'. '
. $tag->faultstring : $tag->return;
149
}
150
}
151
152
$this->log[
'retorno'
] =
''
. $retorno;
153
}
154
}
155
catch
( Exception $ex )
156
{
157
// Para não trancar o webservices caso ocorra algum erro
158
}
159
}
160
161
}
webServicesServer
Definição
webServicesServer.class:40
webServicesServer\handle
handle($soap_request=null)
Definição
webServicesServer.class:53
webServicesServer\$log
$log
Definição
webServicesServer.class:46
classes
contrib
webServicesServer.class
Gerado por
1.10.0