this is my nusoap server php code :
<?PHP
function Test( $name = '' )
{
if( empty( $name ) )
{
throw new SoapFault( '-1' , 'Error !' );
}
return $name;
}
$WS = new nusoap_server;
$WS->configureWSDL('WebService', 'urn:WebService');
$WS->wsdl->schemaTargetNamespace = 'urn:WebService';
$WS->soap_defencoding = 'UTF-8';
$WS->decode_utf8 = false;
$WS->register(
'Test',
array( 'name' => 'xsd:string' ),
array(
'return' => 'xsd:string'
),
'urn:WebService',
'urn:WebService#Test',
'rpc',
'encoded',
'Test Function'
);
$HTTP_RAW_POST_DATA = isset( $HTTP_RAW_POST_DATA ) ? $HTTP_RAW_POST_DATA : '';
$WS->service( $HTTP_RAW_POST_DATA );
?>
and this is my client php code :
<?PHP
$S = new SoapClient( 'http://localhost/server.php' );
try {
echo $S->Test( '' );
} catch( SoapFault $s )
{
echo '<pre dir="ltr">';
print_r( $s->getMessage() );
echo '</pre>';
}
?>
why output of my client is : looks like we got no XML document
?
i want throw to exception and see Error !
where are my problem ?
Solved by editing server php code and replace :
throw new SoapFault( '-1' , 'Error !' );
to
return new soap_fault('-1', '', 'Error !','');