Documentation

CSOAPClient

Methods

Method Description
CSOAPClient Constructor. Configures a SOAP client to use a specific server ($server), SOAP server access point ($path = '/'), web server port ($port).
send Sends a SOAP request created by CSOAPRequest.
setTimeout Sets the response waiting period of a SOAP server.
getRawRequest Returns a string which is a request sent to a SOAP server.
getRawResponse Returns a string which is a response obtained from a SOAP server.
setLogin Sets the SOAP request login for authorisation via HTTP Basic.
setPassword Sets the SOAP request password for authorisation via HTTP Basic.
login Returns the previously set login.
password Returns the previously set password.

Example 1 (internal test)



function TestComponent() 
{
	global $APPLICATION;
	$client = new CSOAPClient( "bitrix.soap", $APPLICATION->GetCurPage() );
	$request = new CSOAPRequest( "wsTestStartOut1", "http://bitrix.soap/" );
	$request->addParameter("str1", "qwe");
	$request->addParameter("str2", "fjdfhgfdh");
	$request->addParameter("int3", "123");
	$response = $client->send( $request );
	echo "Call wsTestStartOut1";
	if ( $response->isFault() )
	{
	    print( "SOAP fault: " . $response->faultCode(). " - " . $response->faultString() . "" );
	}
	else
	    echo "[OK]: ".mydump($response->Value);		
}

Example 2 (external test)

 

function TestComponent() 
{
	$client = new CSOAPClient("ws.strikeiron.com", "/relauto/iplookup/DNS");
	$request = new CSOAPRequest( "DNSLookup", "http://tempuri.org/");
	$request->addSOAPHeader( "LicenseInfo xmlns=\"http://ws.strikeiron.com\"",
			array("UnregisteredUser" => array( "EmailAddress" => "qwerty@mail.ru" ))
		);
	$request->addParameter("server", "www.yandex.ru");
	$response = $client->send( $request );
		
	echo "SOAPRequest: ".htmlspecialchars($client->getRawRequest());
	echo "SOAPResponse: ".htmlspecialchars($client->getRawResponse());
}
© «Bitrix24», 2001-2024
Up