La librairie nusoap permet la création en PHP de webservice basés sur SOAP. Se baser sur un protocole tel que SOAP pour votre webservice, permet de mettre en place simplement la communication entre des applications .net / java / perl … et PHP.

Voici un exemple de serveur SOAP basic en PHP.

register('hello');

function hello($name){

	$returnedString = "Hello ".$name." !";
	return $returnedString;

}

// Return the results.
$s->service($HTTP_RAW_POST_DATA);
?>

Maintenant, faisons une petite page interrogeant notre webservice.

"tellaw");

// Set the WebService URL
$soapclient = new soapclient("http://www.myWebSite.com/ServeurSoap.php");

// Call the WebService and store its result in $result.
$result = $soapclient->call("hello",$parameters);

?>

".$result.""; ?>