Answer the question
In order to leave comments, you need to log in
How to properly truncate the soapAction parameter in the nusoap library on YII1 to a specific action or class method?
Good afternoon,
Such a trouble, it is necessary to correctly cut the handler method - controller action or class method (static or regular) when forming the WSDL .
The project structure has a soap module
It has a ManagersController controller
class ManagersController extends CController
{
public function setData($name, $age, $sex)
{
// логика
}
}
header('Content-Type: text/xml; charset=utf-8');
$this->soap_server->configureWSDL('setWebBox','webServer');
$this->soap_server->decode_utf8 = false;
$this->soap_server->soap_defencoding = 'UTF-8';
$this->soap_server->wsdl->addComplexType(
'ArrayOfString',
'complexType',
'array',
'',
'SOAP-ENC:Array',
[],
[
['ref'=>'SOAP-ENC:Array',
'wsdl:arrayType' => 'SOAP-ENC:string[]',
'arrayType' => 'SOAP-ENC:string[]',
'nillable'=>'true'
]
],
'SOAP-ENC:string'
);
...
$this->soap_server->register(
'setManager',
[
'name'=>'xsd:string',
'age' => 'xsd:int',
'sex' => 'xsd:string',
],
[
'code' => 'xsd:int',
'message' => 'xsd:string'
],
'',
'uri:soap/managers/getData',
'document',
'literal'
);
...
// Подключаем обработчика запросов
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$this->soap_server->service($HTTP_RAW_POST_DATA);
$this->soap_server->register(
'setManager',
[
'ID_1C' => 'xsd:int',
'FIRST_NAME'=>'xsd:string',
'LAST_NAME' => 'xsd:string',
'THIRD_NAME' => 'xsd:string',
'EMAIL' => 'xsd:string',
'PARENT_BRANCH_ID' => 'xsd:int',
'LESS_ONE_YEAR' => 'xsd:int'
],
[
'code' => 'xsd:int',
'message' => 'xsd:string'
],
'',
'',
'document',
'literal'
);
public function nusoapClient()
{
header('Content-Type: text/html; charset=utf-8');
// Создаем экземпляр клиента
$client = new nusoap_client('http://tbox.a-i.kz/public/wbs/service.php/?wsdl');
$client->setCredentials('Web_user','[email protected]','basic');
$params = [
'id' => 199,
'name' => 'RRRR',
'sex' => 'aswe',
'age' => 7,
];
// Вызываем SOAP-метод
$result = $client->call('setManager', $params);
// Отображаем результат
print_r($result);
// Отображаем запрос и ответ
echo '<h2>Запрос</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Ответ</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
die();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question