ต้องการทำเว็บเซอวิสที่เรียกฐานข้อมูลจาก mysql โดยใช้ nusoap ตอนนี้สร้างทั้งฝั่ง server และ client เสร็จแล้ว แต่ตอนเรียกใช้ client ฟ้องว่า Fatal error: Call to undefined method soapclient::getCustomer() in C:\AppServ\www\nusoap\cu_client.php on line 23
ครับ
ฝั่้งเซอเวอร์ Code (PHP)
<?php
include('lib/nusoap.php');
//Set no cache WSDL
ini_set("soap.wsdl_cache_enabled", "0");
//service function
function getCustomer($Value){
//connect database
//require_once('conndb.php');
$objConnect = mysql_connect("localhost","root","12345678") or die("Error Connect to Database");
$objDB = mysql_select_db("test");
mysql_query("SET NAMES UTF8");
$str = "SELECT * FROM cu_table WHERE cu_id = $Value";
$query = mysql_query($str);
while($Result = mysql_fetch_array($query))
{
$Value = $Result['cu_company'];
return $Value;
/*$cu_company = $result['cu_company'];
$cu_name = $result['cu_name'];
$cu_ad1 = $result['cu_ad1'];
$cu_ad2 = $result['cu_ad2'];
$cu_ad3 = $result['cu_ad3'];
$cu_ad4 = $result['cu_ad4'];
$cu_ad5 = $result['cu_ad5'];
$cu_ad6 = $result['cu_ad6'];
$cu_tel = $result['cu_tel'];
return $cu_id;
return $cu_company;
return $cu_name;
return $cu_ad1;
return $cu_ad2;
return $cu_ad3;
return $cu_ad4;
return $cu_ad5;
return $cu_ad6;
return $cu_tel;*/
}
}
//create server instance
$server = new SoapServer("customerwsdl.wsdl");
//add function
$server->addFunction("getCustomer");
//handle server with client
$server->handle();
?>