开发者

Webservice Error while using nusoap.php

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='$n开发者_运维百科ame' 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();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜