Bonjour,
Je souhaite créer un webservice à l'aide de nusoap.
j'ai télécharger les librairies et je souhaite tester en local pour débuter.
Je suis le tuto ici
donc voici mon fichier serveur:
Puis mon fichier client:
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 <?php // Pull in the NuSOAP code require_once('lib/nusoap.php'); // Create the server instance $server = new soap_server; // Register the method to expose $server->register('hello'); // Define the method as a PHP function function hello($name) { return 'Hello, ' . $name; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?>
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 <?php // Pull in the NuSOAP code require_once('lib/nusoap.php'); // Create the client instance $client = new soapclient('http://localhost/diinote/helloworld.php',false); // Call the SOAP method $result = $client->call('hello', array('name' => 'Scott')); // Display the result print_r($result); // Display the request and response echo '<h2>Request</h2>'; echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; echo '<h2>Response</h2>'; echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; ?>
Voici l'erreur que j'ai quand j'essai d'appeler le fichier client:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Fatal error: Cannot redeclare class soapval in C:\Documents and Settings\...\ws\lib\class.soap_val.php on line 102
Savez vous d'ou peut venir cette érreur?
Partager