That's source code of my webservice with postgreSQL:
<?php
require_once('lib/nusoap.php');
$namespace = $URL . '?wsdl';//using soap_server to create server object
$akademik_server = new soap_server();
$akademik_server->configureWSDL('get_list_mahasiswa', $namespace);
function get_list_mahasiswa($param)
{
$host = 'localhost';
$user = 'postgres';
$password = 'correcthorsebatterystaple';
$database = 'abacabadabacaba';
$conn = pg_connect("host=$host dbname=$database user=$user password=$password")
or die ('Could not connect to PostgreSQL : '.pg_errormessage());
$sql_db ="SELECT * FROM mahasiswa WHERE nim='$param'";
$query_db = pg_query($sql_db) or die ('Gagal query :'.pg_errormessage());
$row = pg_num_rows($query_db);
$no = 1;
for ($i = 0; $i < $rows; $i++)
{
$row = pg_fetch_row($query_db, $i);
$items[] = array('nim'=>$row[0],'name'=>$row[1],'address'=>$row[2]);
}
pg_close($conn);
return $items;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$akademik_server->service($HTTP_RAW_POST_DATA);
?>
the output is
XML Parsing Error: junk after document element Location: http://localhost/webservice_soap_testing/mahasiswa_service.php?wsdl Line Number 2, Column 1:
What's the problem in here?
Comments
Post a Comment