configureWSDL('pjjwsdl', 'urn:pjjwsdl'); // Register the data structures used by the service $server->wsdl->addComplexType( 'LoginMahasiswa', 'complexType', 'struct', 'all', '', array( 'usrname' => array('name' => 'usrname', 'type' => 'xsd:string'), 'pwd' => array('name' => 'pwd', 'type' => 'xsd:string') ) ); $server->wsdl->addComplexType( 'DataDiriSiswaOutput', 'complexType', 'struct', 'sequence', '', array( 'username' => array('name' => 'username', 'type' => 'xsd:string'), 'password' => array('name' => 'password', 'type' => 'xsd:string'), 'pesan' => array('name' => 'pesan', 'type' => 'xsd:string') ) ); // Register the method to expose $server->register('DataDiriSiswa', // method name array('data' => 'tns:LoginMahasiswa'), // input parameters array('return' => 'tns:DataDiriSiswaOutput'), // output parameters 'urn:pjjnwsdl', // namespace 'urn:pjjwsdl#DataDiriSiswa', // soapaction 'rpc', // style 'encoded', // use 'Web Service PJJ - Biodata Mahasiswa' // documentation ); // Define the method as a PHP function function DataDiriSiswa($data) { $user=$data["usrname"]; $passwd=$data["pwd"]; if ($user=="xxx@it.student.pens.ac.id" || $passwd=="xxdsdr") $pesan="1111111111111"; elseif ($user=="yyy@it.student.pens.ac.id" || $passwd=="reeeww") $pesan="2222222"; else $pesan="Gagal"; return array( 'username' => $data["usrname"], 'password' =>$data["pwd"], 'pesan' => $pesan ); } // 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); ?>