使用Web服务功能肥皂

时间:2014-03-28 17:41:54

标签: php soap

我需要你的帮助,这是我第一次使用网络服务。我有一个名为“valeur”的函数,当我调用此函数没有参数它工作正常,但当我添加$ min和$ max它不起作用,它不返回随机值但返回“数组”。 服务功能

  

<?php
include('lib/nusoap.php');

$serveur = new soap_server;
$HTTP_RAW_POST_DATA =file_get_contents( 'php://input' );
$serveur->register('valeur');
function valeur($min,$max)
  {
  return rand($min,$max);
  }

$serveur->service($HTTP_RAW_POST_DATA);
?>

这里是客户端

    include('lib/nusoap.php');
$min=$_POST['min'];
$max=$_POST['max'];
$client = new soapclient('http://localhost/projet2/service.php');
$valeur=$client->call("valeur($min,$max)");
$sql="INSERT INTO capteur (latitude, longitude, cp, adr,type,valeur,min,max)
VALUES
('$_POST[lati]','$_POST[longi]','$_POST[cp]','$_POST[adr]','$_POST[type]','$valeur','$_POST[min]','$_POST[max]')";
enter code here

0 个答案:

没有答案