我的Web服务不适用于PHP nusoap

时间:2014-11-26 21:13:44

标签: php web-services wsdl nusoap

我创建了一个Web服务,它在本地工作但不在服务器上工作。我从控制台收到此错误“无法加载资源:服务器响应状态为500(内部服务器错误)”。

这是我的server.php

ini_set("soap.wsdl_cache_enabled", "0");
require_once 'lib/nusoap.php';
$soap = new soap_server;
$soap->configureWSDL('KisiEkle', 'http://php.hoshmand.org/');
$soap->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
$soap->register('xmliste', array('istek' => 'xsd:string'), array('cevap' => 'xsd:string') ,'http://soapinterop.org/');
$soap->service(isset($HTTP_RAW_POST_DATA) ?
    $HTTP_RAW_POST_DATA : '');

function xmliste($istek){
    require_once 'dbHelper.php';
    $dbh = new dbHelper();
    $dbh->begin();
    $qry = $dbh->query("Select * From kisi inner join kan on kan.id_k = kisi.kan_grup");
    $array = array();
    foreach($qry as $row){
        $array[] = array(
            "ad" => $row['ad'],
            "soyad" => $row['soyad'],
            "dogum_tarih" => $row['dogum_tarih'],
            "telefon>" => $row['telefon'],
            "eposta" => $row['eposta'],
            "il" => $row['il'],
            "ilce" => $row['ilce'],
            "adres" => $row['adres'],
            "kan_grup" => $row['isim_kan'],
            "son_tarih" => $row['son_tarih'],
    );
    }
    $sonuc = json_encode($array,JSON_UNESCAPED_UNICODE);
    return $sonuc;

这里是我的client.php

require_once ('lib/nusoap.php');
echo "lib loaded";
$param = array('istek' => 'dfs');
echo "param is working";
$client = new soapclient('http://www.example.com/server.php?wsdl');
echo "wsdl";
$response = $client->call('xmliste', $param);
echo "fonksiyonu çağırdı";
if($client->fault)
{
    echo "Hata: <p>Code: (".$client->faultcode."</p>";
    echo "String: ".$client->faultstring;
}
else
{
    echo $response;
}

我在当地尝试过它并且使用了这个

$client = new soapclient('http://127.0.0.1/myproject/server.php?wsdl');

所以我将文件加载到服务器但它无法正常工作。 “lib loaded”和“param正在工作”写在client.php但不写“wsdl”,我从控制台得到这个错误“无法加载资源:服务器响应状态为500(内部服务器错误)”。请帮帮我。

0 个答案:

没有答案