请问用ajax怎么调用php写的webservice啊

客户端程序:

    $("#szr").click(function(){
        $.ajax({        
            type: "POST",
            contentType:"application/json; charset=utf-8",
            url:"http://192.168.31.228:807/serviceServer.php/hello",
            data:"{}",
            dataType:"json",
            success:function(result){                    
                alert(result.username);
            },
            error:function(ms){
                alert("异常"+ms.responseText);
            }
        });
    });

服务器端程序:
<?php
$wbServer= new SoapServer(null, array('uri'=>'textphpwebservice','soap_version'=>SOAP_1_2));
$wbServer->addFunction('sayhello');
$wbServer->addFunction('mymin');
$wbServer->addFunction('hello');
$wbServer->handle();

$json_arr = array("username"=>"szr","age"=>11,"job"=>"sad");
$json_obj = json_encode($json_arr);
//echo $json_obj;

function sayhello($name){
return "hello ".$name."you are great!";
}

function mymin($a,$b){
return $a>$b?$b:$a;
}

function hello(){
return $json_obj;

}
exit();
?>

报错:500 (Internal Server Error)
哪位大神知道是怎么回事啊??

你先了解下什么是webservice!具体在你的项目引用网络引用就能在代码中访问了,通过后台去访问接口

例子:http://www.tuicool.com/articles/iueYNj
你的服务器虽然是php写的(假设没写错),但是它是基于soap协议的。

请问解决了吗,碰到一样的问题