Location: PHPKode > projects > SOAP SQL > soapsql/demos/nusoap/nusoap_client.php
<?php
/*
 * NuSOAP Demo
 * Created: Apr 18, 2007
 * License: LGPL (open source)
 * BungeeLabs, Inc.
 * 
 * This PHP script demonstrates how to create a simple NuSOAP WSDL client.
 * To be used with 'nusoap_server.php'.
 * 
 * This is not intended to be used as part of the SoapSQL library, rather to show
 * how NuSOAP is used if you desire to create your own WSDL from scratch.
 */
require_once('nusoap/nusoap.php'); 
require_once("client_helper.php");

$wsdl = "http://localhost/demos/nusoap/nusoap_server.php?wsdl";
$ns = "http://soaptest/";

$client = new soap_client($wsdl, true);
$err = $client->getError();
if ($err) {
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
	exit;
} 

$params = array('firstname' => 'Bob', 'age' => 15); 
$result = $client->call('Hello', serializeArray($params), $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