<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
if(!CModule::IncludeModule("webservice") || !CModule::IncludeModule("iblock"))
return;
// наш новый класс наследуется от базового IWebService
class CMyserviceWS extends IWebService
{
function TestServise($INPUTPARAM)
{
$result = pow($INPUTPARAM, 2);
return Array("OUTPUTPARAM"=>$result);
}
function GetWebServiceDesc()
{
$wsdesc = new CWebServiceDesc();
$wsdesc->wsname = "bitrix.webservice.testservice"; // название сервиса
$wsdesc->wsclassname = "CMyserviceWS"; // название класса
$wsdesc->wsdlauto = true;
$wsdesc->wsendpoint = CWebService::GetDefaultEndpoint();
$wsdesc->wstargetns = CWebService::GetDefaultTargetNS();
$wsdesc->classTypes = array();
$wsdesc->structTypes = Array();
$wsdesc->classes = array(
"CMyserviceWS"=> array(
"TestServise" => array(
"type" => "public",
"input" => array(
"INPUTPARAM" => array("varType" => "integer"),
),
"output" => array(
"OUTPUTPARAM" => array("varType" => "integer")
),
"httpauth" => "Y"
),
)
);
return $wsdesc;
}
}
$arParams["WEBSERVICE_NAME"] = "bitrix.webservice.testservice";
$arParams["WEBSERVICE_CLASS"] = "CMyserviceWS";
$arParams["WEBSERVICE_MODULE"] = "";
// передаем в компонент описание веб-сервиса
$APPLICATION->IncludeComponent(
"bitrix:webservice.server",
"",
$arParams
);
die();
?>
|