Bonjour, debutant en web services, je rencontre quelques problemes en suivant les tutoriaux.
Pour simplifier mes premiers tests, j'utilise nusoap.


Voici mon server
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
 
<?php 
   require_once('../lib/nusoap.php'); 
 
 
   $server = new soap_server; 
   $server->register('taxCalc'); 
 
   function taxCalc($rate, $sub) 
   { 
      if($rate == '' || $rate <= 0) 
      { 
         return new soap_fault('Client', '', 'Taks moet groter zijn dan nul.', ''); 
      } 
 
      if($sub == '' || $sub <= 0) 
      { 
         return new soap_fault('Client', '', 'Subtotaal moet groeter zijn dan nul.', ''); 
      } 
 
      return (($rate / 100) * $sub) + $sub; 
   } 
 
   $server->service($HTTP_RAW_POST_DATA); 
   exit(); 
?>
et mon 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
18
<?php 
   require_once('../lib/nusoap.php'); 
 
   $param = array('rate' => '7', 'sub' => '816'); 
 
   $client = new soapclient('server.php'); 
   $response = $client->call('taxCalc', $param); 
 
   if($client->fault) 
   { 
      echo "Fault: <p>Code: {$client->faultcode}<br>"; 
      echo "String: {$client->faultstring}"; 
   } 
   else 
   { 
      echo "$". $response; 
   } 
?>
A l'execution, j'obtiens que $ .

Je tiens a preciser que mon serveur a bien php_soap.dll enable
http://intevit.com/ws/ex2/

Egalement un autre test qui plante :


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
<?php
 
// Pull in the NuSOAP code
require_once('../nusoap.php');
function getRot13($pInput){
$rot = str_rot13($pInput);return($rot);
}
function getMirror($pInput){
$mirror = strrev($pInput);
 
return($mirror);
}
 
// turn off the wsdl cache
ini_set(“soap.wsdl_cache_enabled”, "0");
 
$server = new SoapServer("scramble.wsdl");
 
$server->addFunction("getRot13");
$server->addFunction("getMirror");
 
$server->handle();
?>

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
18
19
<?php
// Pull in the NuSOAP code
require_once('../lib/nusoap.php');
 
// turn off the WSDL cache
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient("http://www.joelhainley.com/examples/soap/scramble.wsdl");
 
$origtext = "mississippi";
 
print("The original text : $origtext");
$scramble = $client->getRot13($origtext);
 
 
print("The scrambled text : $scramble");
 
$mirror = $client->getMirror($scramble);
print("The mirrored text : $mirror");
?>
me renvoie The original text : mississippi
Fatal error: Call to undefined method: soapclient->getrot13() in /homez.221/intevit/www/ws/ex1/client.php on line 12

url :
http://intevit.com/ws/ex1/client.php


merci de l'aide.