Return Array Data Nu Soap
Hello every buddy,Here i'am :)....In this tutorial i will share about NuSoap WSDL..First i user NuSoap-0.9.5, so follow my step:
- Commenting out nusoap.php line 6132:
//$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - And then copy paste this code: (below)
- Create your client nusoap
- FINISH
date_default_timezone_set('Asia/Jakarta);
require_once 'inc/nusoap-0.9.5/nusoap.php';
$ns = "http://webservice.sim.pnj.ac.id/mahasiswa.php";
// Create SOAP Server
$server = new soap_server();
$server->configureWSDL('Mahasiswa', $ns);
function Nilai()
{
$result = array();
$result[] = array('matakuliah' => 'Bahasa Indonesia', 'nilai' => 88);
$result[] = array('matakuliah' => 'Fisika', 'nilai' => 85);
return $result;
}
$server->wsdl->addComplexType(
'MahasiswaNilai',
'complexType',
'struct',
'all',
'',
array(
'matakuliah' => array('name'=>'matakuliah','type'=>'xsd:string'),
'nilai' => array('name'=>'nilai','type'=>'xsd:int')
)
);
$server->wsdl->addComplexType(
'NilaiArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:MahasiswaNilai[]')
),
'tns:MahasiswaNilai'
);
$server->register(
'Nilai',
array(),
array('return'=>'tns:NilaiArray'),
$ns,false,'rpc','encoded','Menampilkan Nilai Mahasiswa PNJ');
$server->service(isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '');
exit();
?>
0 comments:
You can post comment with english language or indonesia language.
Anda bisa memberikan komentar dalam bahasa inggris atau bahasa indonesia.