I am trying to create a php web service using nusoap lib. My code is reproduced below.
include(“lib/nusoap.php”);
$server = new soap_server;
$server->register(‘login’);
function login($name,$pwd)
{
$link=mysql_connect("localhost","root","");
mysql_select_db("mydb") or $status = 'C';
$query = "select * from users where login='$name' and password='$pwd'";
$result = mysql_query($query);
if (!$result)
{
return "no such user";
}
else
{
return "user exists";
}
mysql_close($link);
}
// 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);
my php version is 5.3.5
I get the following error
XML Parsing Error: junk after document element
Location: http://localhost/androidta/webservice/server.php
Line Number 2, Column 1:
Can anybody point me any issue in the code?
i encountered this problem today as well.
what i did is:
Change:
$server = new soap_server;
To:
$server = new soap_server();