问题一:
Error: Client, string: looks like we got no XML document<?php
//client端soap_client.php
try
{
@$oper_post = $_GET['post']; 
@$oper_get = $_GET['get'];
$client = new SoapClient(null,
  array('location' =>"http://127.0.0.1:8090/soap_server.php",'uri' => "http://127.0.0.1:8090/")
);
    //echo $client->getName();
// http://120.79.230.135:8090/clientsoap.php?get=login&mobilephone=13728644592&password=123
if($oper_get != null)
{
switch($oper_get)
{
case "login":// 登录
    {
    $Relust = $client->GetLogin('login', $_GET['mobilephone'], $_GET['password']);// $userid 只查询某一个投资人
    break;
    }
}
  }/**/
echo $Relust;
}
catch (SoapFault $fault)
{
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
?>
//////soap_server.php
<?php
include './soap_query.php'; $classExample = array(); 
$soap = new SoapServer(null,array('uri'=>"http://127.0.0.1:8090/",'classExample'=>$classExample));
$soap->setClass('OperationData');
$soap->handle();
// 注释 include './soap_query.php', QueryData 移到 soap_query.php 则出现
// Error: Client, string: looks like we got no XML document
/*
  function QueryData($sql, $rootname)
{
return '00000';
}
*/
class OperationData 
{
    public $name = 'Chester';
 
    function getName() 
    {
return $this->name;
    } function GetLogin($rootname, $phone, $passward)
{
$sql = 'select mobilephone from userinfo where mobilephone=';
$strpoint ="'";
$sql = $sql.$strpoint.$phone.$strpoint;
$sqland = ' and passward =';
$sqland = $sqland.$strpoint.$passward.$strpoint;
$sql = $sql.$sqland;
return QueryData($sql, $rootname);
  }
}
?>
/////soap_query.php
<?php
  function QueryData($sql, $rootname)
{
return '00000';
}
?>问题二:
在php文件的开头加上:
header("Content-type:text/xml")
报错:
//This page contins the following errors:
//error on line 2 at column 1: Extra content at the end of the document
//Below is a rendering of the page up to the first error.

解决方案 »

  1.   

    Error: Client, string: looks like we got no XML document
    错误:客户机,字符串:看起来我们没有XML文档//This page contins the following errors:
    //error on line 2 at column 1: Extra content at the end of the document
    //Below is a rendering of the page up to the first error.
    / /此页面含有以下错误:
    /第2行第1行的错误:文档结尾处的额外内容
    //下面是对第一个错误的页面呈现。
      

  2.   

    // 不注释 include './soap_query.php', QueryData 移到 soap_query.php 则出现
    // Error: Client, string: looks like we got no XML document
    /*
      function QueryData($sql, $rootname)
    {
    return '00000';
    }
    */