Location: PHPKode > projects > SOAP SQL > soapsql/demos/soapsql_client.php
<?php
/*
 * SOAP SQL Client Test
 * Created: Apr 18, 2007
 * License: LGPL (open source)
 * BungeeLabs, Inc.
 * 
 * This PHP script demonstrates how to create a simple NuSOAP client.
 * This script is to be used with the web service created by 'soapsql_server.php'.
 * 
 * Dependencies: 
 * NuSOAP at http://dietrich.ganx4.com/nusoap  
 * PEAR MDB2 at http://pear.php.net/package/MDB2
 */
require_once('nusoap/nusoap.php'); 

$wsdl = "http://localhost/demos/soapsql_server.php?wsdl";
$ns = "http://testsoapsql/";
$client = new soap_client($wsdl, true);
$err = $client->getError();
if ($err) {
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
	exit;
} 

$params = array('name' => 'Dave'); 
$sv = new soapval('tns:MyQuery', false, $params);
$result = $client->call('MyQuery', $sv->serialize(), $ns); 

//Uncomment to test Secure Insert
//$params = array('securityParams' => array('securityToken' =>'abcdefghijklmnopqrstuvwxyz'), 'name' => 'Jim', 'age' => 34); 
//$sv = new soapval('tns:SecureInsert', false, $params);
//$result = $client->call('SecureInsert', $sv->serialize(), $ns);


if ($client->fault) {
	echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
	$err = $client->getError();
	if ($err) {
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
	} else {
		echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
	}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

?>
Return current item: SOAP SQL