CSOAPServer
Methods
Method | Description |
---|---|
GetRequestData | Returns the received SOAP request. |
GetResponseData | Returns the SOAP packet sent in response to a request. GetResponseData can only be used after calling ProcessRequest. |
boolean AddServerResponser( CSOAPServerResponser &respobject ) |
Registers the SOAP request handler. Handlers that inherit from CSOAPServerResponser must be registered prior to calling ProcessRequest. |
ShowRawResponse | Creates and sends a SOAP response packet containing data as CXMLCreator. |
ShowResponse | Creates and sends a SOAP response packet containing the converted data. |
ShowSOAPFault | Creates and sends a SOAP error response packet. |
ProcessRequest | Performs SOAP request processing. Handlers (CSOAPServerResponser) must be registered using AddServerResponser before calling this method. Returns true on success, or false otherwise. |
stripHTTPHeader | Removes the HTTP header from an XML document. |
Example
In this example, $arParams["SOAPSERVER_RESPONSER"] contains SOAP handlers.
Usually, a SOAP handler is created in a component and saved to an array $arParams["SOAPSERVER_RESPONSER"]. Then, after the webservice.server component becomes active, the following code is executed.
// In a component
// Create a handler instance
$research =& new CMSSOAPResearch();
// Set the handler parameters
$research->provider_id = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}';
$research->service_id = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}';
$research->add_tittle = "";
$research->query_path = "http://{$_SERVER[HTTP_HOST]}/ws/wscauth.php";
$research->registration_path = "http://{$_SERVER[HTTP_HOST]}/ws/wscauth.php";
// Store the handler to be passed to webservice.server
$arParams["SOAPSERVER_RESPONSER"] = array( &$research );
.........
// In "webservice.server"
$server = new CSOAPServer();
for ($i = 0; $i<count($arParams["SOAPSERVER_RESPONSER"]); $i++)
{
$server->AddServerResponser($arParams["SOAPSERVER_RESPONSER"][$i]);
}
$result = $server->ProcessRequest();
© «Bitrix24», 2001-2024