function TestComponent() { global $APPLICATION; $client = new CSOAPClient("bitrix.soap", $APPLICATION->GetCurPage()); $client->setLogin("admin"); $client->setPassword("123456"); $request = new CSOAPRequest("GetHTTPUserInfo", CWebService::GetDefaultTargetNS()); //$request->addParameter("stub", 0); $response = $client->send($request); if ($response->FaultString) { echo $response->FaultString; } else { echo "Call GetHTTPUserInfo(): <br>" . mydump($response->Value) . "<br>"; } }
function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bdv.webservice.addproducts"; // название сервиса $wsdesc->wsclassname = "CMainWS"; // название класса $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes = array(); $wsdesc->classes = array("CMainWS" => array("AddProduct" => array("type" => "public", "input" => array("NAME" => array("varType" => "string")), "output" => array("id" => array("varType" => "integer")), "httpauth" => "Y"), "AddCategory" => array("type" => "public", "input" => array("NAME" => array("varType" => "string"), "PARENT_ID" => array("varType" => "string", "strict" => "no")), "output" => array("id" => array("varType" => "integer")), "httpauth" => "Y"), "DeleteCategory" => array("type" => "public", "input" => array("ID" => array("varType" => "integer")), "output" => array("OK" => array("varType" => "integer")), "httpauth" => "Y"), "GetCategory" => array("type" => "public", "input" => array(), "output" => array("return" => array("varType" => "ArrayOfsCategoryDataLite", "arrType" => "sCategoryDataLite")), "httpauth" => "Y"), "GetIBlockCatalog" => array("type" => "public", "input" => array(), "output" => array("return" => array("varType" => "integer")), "httpauth" => "Y"))); $wsdesc->structTypes["sCategoryDataLite"] = array("ID" => array("varType" => "integer", "strict" => "no"), "NAME" => array("varType" => "string", "strict" => "no"), "DEPTH_LEVEL" => array("varType" => "integer", "strict" => "no")); return $wsdesc; }
function ProcessRequestBody(&$cserver, $body) { $functionName = $body->name(); $namespaceURI = $body->namespaceURI(); $requestNode = $body; // If this is request name in functionName, get functionName. if (!in_array($functionName, $this->FunctionList) and isset($this->MessageTags[$functionName])) { $functionName = $this->MessageTags[$functionName]; } if (!in_array($functionName, $this->FunctionList)) { CSOAPServer::ShowSOAPFault("Trying to access unregistered function: " . $functionName); return true; } $objectName = ""; $params = array(); $paramsDecoder = new CSOAPResponse($functionName, $namespaceURI); $paramsDecoder->setTypensVars($this->TypensVars); if (!isset($this->TypensVars[$functionName]) or !isset($this->TypensVars[$functionName]["myclassname"]) or !isset($this->TypensVars[$functionName]["input"])) { CSOAPServer::ShowSOAPFault("Requested function has no type specified: " . $functionName); return true; } $objectName = $this->TypensVars[$functionName]["myclassname"]; $inputParams = $this->TypensVars[$functionName]["input"]; $httpAuth = "N"; if (isset($this->TypensVars[$functionName]["httpauth"])) { $httpAuth = $this->TypensVars[$functionName]["httpauth"]; } if ($httpAuth == "Y" and !CWebService::MethodRequireHTTPAuth($objectName, $functionName)) { CSOAPServer::ShowSOAPFault("Requested function requires HTTP Basic Auth to be done before."); return true; } $requestParams = array(); // reorganize params foreach ($requestNode->children() as $parameterNode) { if (!$parameterNode->name()) { continue; } $requestParams[$parameterNode->name()] = $parameterNode; } // check parameters/decode // check strict params foreach ($inputParams as $pname => $param) { $decoded = null; if (isset($requestParams[$pname])) { $decoded = $paramsDecoder->decodeDataTypes($requestParams[$pname]); } if (is_object($decoded) and (get_class($decoded) == "CSOAPFault" or get_class($decoded) == "csoapfault")) { CSOAPServer::ShowSOAPFault($decoded); return true; } if (!isset($decoded) and (!isset($param["strict"]) or isset($param["strict"]) and $param["strict"] == "strict")) { CSOAPServer::ShowSOAPFault("Request has no enought params of strict type to be decoded. "); return true; } $params[] = $decoded; } //AddMessage2Log(mydump($params)); unset($paramsDecoder); $object = null; if (class_exists($objectName)) { $object = new $objectName(); } if (is_object($object) && method_exists($object, $functionName)) { $this->ShowResponse($cserver, $functionName, $namespaceURI, call_user_func_array(array($object, $functionName), $params)); } else { if (!class_exists($objectName)) { $this->ShowResponse($cserver, $functionName, $namespaceURI, new CSOAPFault('Server Error', 'Object not found')); } else { $this->ShowResponse($cserver, $functionName, $namespaceURI, new CSOAPFault('Server Error', 'Method not found')); } } return true; }
public static function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bitrix.webservice.calendar"; $wsdesc->wsclassname = "CCalendarWebService"; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes = array(); $wsdesc->classes = array( "CCalendarWebService" => array( "GetList" => array( "type" => "public", "name" => "GetList", "input" => array( "listName" => array("varType" => "string"), ), "output" => array( "GetListResult" => array("varType" => 'any'), ), 'httpauth' => 'Y' ), 'GetListItemChanges' => array( 'type' => 'public', 'name' => 'GetListItemChanges', 'input' => array( "listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict'=> 'no'), 'since' => array('varType' => 'string', 'strict' => 'no'), ), 'output' => array( 'GetListItemChangesResult' => array('varType' => 'any'), ), 'httpauth' => 'Y' ), 'GetListItemChangesSinceToken' => array( 'type' => 'public', 'name' => 'GetListItemChangesSinceToken', 'input' => array( "listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict'=> 'no'), 'query' => array('varType' => 'any', 'strict' => 'no'), 'rowLimit' => array('varType' => 'string', 'strict' => 'no'), 'changeToken' => array('varType' => 'string', 'strict' => 'no'), ), 'output' => array( 'GetListItemChangesSinceTokenResult' => array('varType' => 'any'), ), 'httpauth' => 'Y' ), 'UpdateListItems' => array( 'type' => 'public', 'name' => 'UpdateListItems', 'input' => array( "listName" => array("varType" => "string"), 'updates' => array('varType' => 'any', 'strict' => 'no'), ), 'output' => array( 'UpdateListItemsResult' => array('varType' => 'any') ), 'httpauth' => 'Y' ), ), ); return $wsdesc; }
function &GetWebServiceDeclaration($className) { if (isset($GLOBALS["wsdescs"][$className])) { return $GLOBALS["wsdescs"][$className]; } $ifce =& CWebService::GetInterface($className); if (!is_object($ifce)) { return false; } return $ifce->GetWebServiceDesc(); }
function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bitrix.webservice.intranet.contacts"; $wsdesc->wsclassname = "CIntranetContactsWS"; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes = array(); $wsdesc->classes = array("CIntranetContactsWS" => array("GetList" => array("type" => "public", "name" => "GetList", "input" => array("listName" => array("varType" => "string")), "output" => array("GetListResult" => array("varType" => 'any')), 'httpauth' => 'Y'), 'GetListItemChanges' => array('type' => 'public', 'name' => 'GetListItemChanges', 'input' => array("listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict' => 'no'), 'since' => array('varType' => 'string', 'strict' => 'no')), 'output' => array('GetListItemChangesResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'GetListItemChangesSinceToken' => array('type' => 'public', 'name' => 'GetListItemChangesSinceToken', 'input' => array("listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict' => 'no'), 'query' => array('varType' => 'any', 'strict' => 'no'), 'rowLimit' => array('varType' => 'string', 'strict' => 'no'), 'changeToken' => array('varType' => 'string', 'strict' => 'no')), 'output' => array('GetListItemChangesSinceTokenResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'GetAttachmentCollection' => array('type' => 'public', 'name' => 'GetAttachmentCollection', 'input' => array("listName" => array("varType" => "string"), "listItemID" => array("varType" => "string")), 'output' => array('GetAttachmentCollectionResult' => array('varType' => 'any')), 'httpauth' => 'Y'))); return $wsdesc; }
public function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = 'bitrix.crm.lead.webservice'; $wsdesc->wsclassname = 'CCrmLeadWS'; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes = array(); $wsdesc->classes = array('CCrmLeadWS' => array('GetFieldsList' => array('type' => 'public', 'name' => 'GetFieldsList', 'input' => array(), 'output' => array('GetFieldsListResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'Add' => array('type' => 'public', 'name' => 'Add', 'input' => array('data' => array('varType' => 'any')), 'output' => array('result' => array('varType' => 'string')), 'httpauth' => 'Y'))); return $wsdesc; }
function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bitrix.webservice.tasks"; $wsdesc->wsclassname = "CTasksWebService"; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes = array(); $wsdesc->classes = array("CTasksWebService" => array("GetList" => array("type" => "public", "name" => "GetList", "input" => array("listName" => array("varType" => "string")), "output" => array("GetListResult" => array("varType" => 'any')), 'httpauth' => 'Y'), 'GetListItemChanges' => array('type' => 'public', 'name' => 'GetListItemChanges', 'input' => array("listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict' => 'no'), 'since' => array('varType' => 'string', 'strict' => 'no')), 'output' => array('GetListItemChangesResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'GetListItemChangesSinceToken' => array('type' => 'public', 'name' => 'GetListItemChangesSinceToken', 'input' => array("listName" => array("varType" => "string"), "viewFields" => array("varType" => "any", 'strict' => 'no'), 'query' => array('varType' => 'any', 'strict' => 'no'), 'rowLimit' => array('varType' => 'string', 'strict' => 'no'), 'changeToken' => array('varType' => 'string', 'strict' => 'no')), 'output' => array('GetListItemChangesSinceTokenResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'GetAttachmentCollection' => array('type' => 'public', 'name' => 'GetAttachmentCollection', 'input' => array("listName" => array("varType" => "string"), "listItemID" => array("varType" => "string")), 'output' => array('GetAttachmentCollectionResult' => array('varType' => 'any')), 'httpauth' => 'Y'), 'DeleteAttachment' => array('type' => 'public', 'name' => 'DeleteAttachment', 'input' => array("listName" => array("varType" => "string"), "listItemID" => array("varType" => "string"), "url" => array("varType" => "string")), 'output' => array('DeleteAttachmentResult' => array('varType' => 'string')), 'httpauth' => 'Y'), 'AddAttachment' => array('type' => 'public', 'name' => 'AddAttachment', 'input' => array("listName" => array("varType" => "string"), "listItemID" => array("varType" => "string"), "fileName" => array("varType" => "string"), "attachment" => array("varType" => "base64Binary")), 'output' => array('AddAttachmentResult' => array('varType' => 'string')), 'httpauth' => 'Y'), 'UpdateListItems' => array('type' => 'public', 'name' => 'UpdateListItems', 'input' => array("listName" => array("varType" => "string"), 'updates' => array('varType' => 'any', 'strict' => 'no')), 'output' => array('UpdateListItemsResult' => array('varType' => 'any')), 'httpauth' => 'Y'))); return $wsdesc; }
} $arParams["WSDESCR"] = CWebService::GetWebServiceDeclaration($arParams["WEBSERVICE_CLASS"]); $this->IncludeComponentTemplate(); } else { $APPLICATION->RestartBuffer(); header("Pragma: no-cache"); if (!class_exists($arParams["WEBSERVICE_CLASS"]) and !CModule::IncludeModule($arParams["WEBSERVICE_MODULE"])) { return; } CWebService::SetComponentContext($arParams); CWebService::RegisterWebService($arParams["WEBSERVICE_CLASS"]); if (isset($_GET["wsdl"])) { header("Content-Type: text/xml"); echo CWebService::GetWSDL($arParams["WEBSERVICE_NAME"]); die; } else { if (isset($_GET["test"])) { echo CWebService::TestComponent($arParams["WEBSERVICE_NAME"]); die; } else { if ($_SERVER["REQUEST_METHOD"] == "POST" and !isset($_REQUEST["directcall"])) { CWebService::SOAPServerProcessRequest($arParams["WEBSERVICE_NAME"]); } else { $arParams["WSDESCR"] = CWebService::GetWebServiceDeclaration($arParams["WEBSERVICE_NAME"]); $this->IncludeComponentTemplate(); } } } //die(); } }
function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bitrix.webservice.statistic"; $wsdesc->wsclassname = "CStatisticWS"; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes["Session"] = array("ID" => array("varType" => "integer"), "ADV_ID" => array("varType" => "integer"), "REFERER1" => array("varType" => "string"), "REFERER2" => array("varType" => "string"), "REFERER3" => array("varType" => "string"), "ADV_BACK" => array("varType" => "string"), "LAST_SITE_ID" => array("varType" => "string"), "URL_LAST" => array("varType" => "string"), "URL_LAST_404" => array("varType" => "string"), "IP_LAST" => array("varType" => "string"), "HITS" => array("varType" => "integer"), "USER_AUTH" => array("varType" => "string"), "STOP_LIST_ID" => array("varType" => "integer"), "GUEST_ID" => array("varType" => "integer"), "FAVORITES" => array("varType" => "string"), "LAST_USER_ID" => array("varType" => "string"), "SESSION_TIME" => array("varType" => "string"), "DATE_LAST" => array("varType" => "string"), "NEW_GUEST" => array("varType" => "string"), "FIRST_URL_FROM" => array("varType" => "string"), "FIRST_SITE_ID" => array("varType" => "string"), "URL_FROM" => array("varType" => "string"), "COUNTRY_ID" => array("varType" => "string"), "COUNTRY_NAME" => array("varType" => "string")); $wsdesc->structTypes["Top"] = array("id" => array("varType" => "int"), "name" => array("varType" => "string"), "today" => array("varType" => "integer"), "yesterday" => array("varType" => "integer"), "bef_yesterday" => array("varType" => "integer"), "all" => array("varType" => "integer")); $wsdesc->structTypes["UsersOnlineList"] = array("GUEST_COUNT" => array("varType" => "integer"), "SESSION_COUNT" => array("varType" => "integer"), "SESSIONS" => array("varType" => "ArrayOfSession", "arrType" => "Session")); $wsdesc->structTypes["CommonValues"] = array("TOTAL_HITS" => array("varType" => "integer"), "TODAY_HITS" => array("varType" => "integer"), "YESTERDAY_HITS" => array("varType" => "integer"), "B_YESTERDAY_HITS" => array("varType" => "integer"), "TOTAL_SESSIONS" => array("varType" => "integer"), "TODAY_SESSIONS" => array("varType" => "integer"), "YESTERDAY_SESSIONS" => array("varType" => "integer"), "B_YESTERDAY_SESSIONS" => array("varType" => "integer"), "TOTAL_EVENTS" => array("varType" => "integer"), "TODAY_EVENTS" => array("varType" => "integer"), "YESTERDAY_EVENTS" => array("varType" => "integer"), "B_YESTERDAY_EVENTS" => array("varType" => "integer"), "TOTAL_HOSTS" => array("varType" => "integer"), "TODAY_HOSTS" => array("varType" => "integer"), "YESTERDAY_HOSTS" => array("varType" => "integer"), "B_YESTERDAY_HOSTS" => array("varType" => "integer"), "TOTAL_GUESTS" => array("varType" => "integer"), "TODAY_GUESTS" => array("varType" => "integer"), "YESTERDAY_GUESTS" => array("varType" => "integer"), "B_YESTERDAY_GUESTS" => array("varType" => "integer"), "TODAY_NEW_GUESTS" => array("varType" => "integer"), "YESTERDAY_NEW_GUESTS" => array("varType" => "integer"), "B_YESTERDAY_NEW_GUESTS" => array("varType" => "integer"), "TOTAL_FAVORITES" => array("varType" => "integer"), "TODAY_FAVORITES" => array("varType" => "integer"), "YESTERDAY_FAVORITES" => array("varType" => "integer"), "B_YESTERDAY_FAVORITES" => array("varType" => "integer"), "ONLINE_GUESTS" => array("varType" => "integer"), "ONLINE_LIST" => array("varType" => "UsersOnlineList")); $wsdesc->structTypes["LiveFeedData"] = array("TITLE" => array("varType" => "string"), "MESSAGE" => array("varType" => "string"), "TEXT_MESSAGE" => array("varType" => "string"), "URL" => array("varType" => "string")); $wsdesc->classes = array("CStatisticWS" => array("UsersOnline" => array("type" => "public", "name" => "UsersOnline", "input" => array(), "output" => array("user" => array("varType" => "UsersOnlineList"))), "GetCommonValues" => array("type" => "public", "name" => "GetCommonValues", "input" => array(), "output" => array("user" => array("varType" => "CommonValues"))), "GetAdv" => array("type" => "public", "name" => "GetAdv", "input" => array(), "output" => array("adv" => array("varType" => "ArrayOfTop", "arrType" => "Top"))), "GetEvents" => array("type" => "public", "name" => "GetEvents", "input" => array(), "output" => array("adv" => array("varType" => "ArrayOfTop", "arrType" => "Top"))), "GetPhrases" => array("type" => "public", "name" => "GetPhrases", "input" => array(), "output" => array("adv" => array("varType" => "ArrayOfTop", "arrType" => "Top"))), "GetRefSites" => array("type" => "public", "name" => "GetRefSites", "input" => array(), "output" => array("adv" => array("varType" => "ArrayOfTop", "arrType" => "Top"))), "GetSearchers" => array("type" => "public", "name" => "GetSearchers", "input" => array(), "output" => array("adv" => array("varType" => "ArrayOfTop", "arrType" => "Top"))), "GetLiveFeedData" => array("type" => "public", "name" => "GetLiveFeedData", "input" => array("site_id" => array("varType" => "string", "strict" => "no"), "lang" => array("varType" => "string", "strict" => "no")), "output" => array("livefeeddata" => array("varType" => "LiveFeedData"))))); return $wsdesc; }
function GetWebServiceDesc() { $wsdesc = new CWebServiceDesc(); $wsdesc->wsname = "bitrix.webservice.sale"; $wsdesc->wsclassname = "CSaleWS"; $wsdesc->wsdlauto = true; $wsdesc->wsendpoint = CWebService::GetDefaultEndpoint(); $wsdesc->wstargetns = CWebService::GetDefaultTargetNS(); $wsdesc->classTypes = array(); $wsdesc->structTypes["LiveFeedData"] = array("TITLE" => array("varType" => "string"), "MESSAGE" => array("varType" => "string"), "TEXT_MESSAGE" => array("varType" => "string"), "URL" => array("varType" => "string")); $wsdesc->classes = array("CSaleWS" => array("GetLiveFeedData" => array("type" => "public", "name" => "GetLiveFeedData", "input" => array("site_id" => array("varType" => "string", "strict" => "no"), "lang" => array("varType" => "string", "strict" => "no")), "output" => array("livefeeddata" => array("varType" => "LiveFeedData"))))); return $wsdesc; }