Bonjour,

je suis débutante avec SOAP et je suis en train de réaliser une application avec web service. Mon but est de récupérer les données d'une base de donnée. J'ai effectué cette code mais rien ne s'affiche...
Serveur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
@mysql_connect("127.0.0.1","root","");
@mysql_select_db("service");
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('MyService', 'urn:MyService');
                // Character encoding
                $server->soap_defencoding = 'utf-8';
 $server->register(
                        'GetData',
                        array('ID' => 'xsd:int'),
                        array('return' =>'xsd:string'),
                          'urn:MyServicewsdl',
                        'urn:MyServicewsdl#GetData',
                        'rpc',
                        'literal',
                        'Some comments about function 2'
                    );function GetData($ID) {
 
                        $sql = mysql_query("select * from MyUsers where ID = '$ID'");
                           while($result = mysql_fetch_array($sql)){
                            echo "<br>".$result["FirstName"]."-".$result["LastName"]."</br>";
                        }
 
                }
                //-------------------------------------------------
                $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
                $server->service($HTTP_RAW_POST_DATA);
?>
client.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
 // Pull in the NuSOAP code
    require_once('lib/nusoap.php');
    // Create the client instance
    $client = new nusoap_client('http://localhost/test1/MyService.php');
    // Check for an error
    $err = $client->getError();
	 // Call the SOAP method
 
    $result = $client->call('GetData', array('ID' =>'1'));
	echo $result ;
 
if ($client->fault) {
    echo "<h2>Fault</h2><pre>";
    print_r($result);
    echo "</pre>";
}
else {
    $error = $client->getError();
    if ($error) {
        echo "<h2>Error</h2><pre>" . $error . "</pre>";
    }
    else {
        echo "<h2>Books</h2><pre>";
        echo $result;
        echo "</pre>";
    }
}
?>