<?php
 
$reqestPayloadString = <<<XML
<greet>Hello Service!</greet>
XML;
 
try
{
        $message = new WSMessage($reqestPayloadString, 
                array("to" => "http://localhost/hello_service.php"));
        
        $client = new WSClient();
        
        $response = $client->request($message);
        
        echo "Hello service replied saying: '";
        echo $response->str;
        echo "'\n";
}
catch (Exception $e) 
{
        
        if ($e instanceof WSFault) 
        {
            $fault = $e;
                printf("Soap Fault received with code '%s' and reason '%s'\n", 
                        $fault->code, $fault->reason);
        }
        else 
        {
                printf("Exception caught with message '%s'\n", $e->getMessage());
        }
}
 
?>