Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] Bad Request in E:\server_new\weborb\services\etim\ZF\soap\MyClient.php:8 Stack trace: #0 [internal function]: SoapClient->__call('Add', Array) #1 E:\server_new\weborb\services\etim\ZF\soap\MyClient.php(8): SoapClient->Add(1, 2) #2 {main} thrown in E:\server_new\weborb\services\etim\ZF\soap\MyClient.php on line 8 
引起这个问题是什么原因呢?客户端
<?php
try{
$soap = new SoapClient(null,array(
"location" => "http://localhost:8666/weborb/services/etim/ZF/soap/MyServer.php",
"uri" => "abcd", //资源描述符服务器和客户端必须对应
));echo $soap->Add(1,2);
}catch(Exction $e){
echo print_r($e->getMessage().'---',true);
}
?>
 
服务端
<?php
class service
{
  public function HelloWorld()
  {
  return "Hello";
  }
  public function Add($a,$b)
  {
  return $a+$b;
  }
}
$server=new SoapServer(null,array('uri' => "abcd"));
$server->setClass("service");
$server->handle($HTTP_RAW_POST_DATA);
?>

解决方案 »

  1.   

    今天用php 配置 webservice 安装好php5.2和apache 2.2之后 配置 php.ini 
    将这句:前面的分号删除 :extension=php_soap.dll在www目录下新建文件:serverSoap.php 内容如下<?php$soap = new SoapServer(null,array('uri'=>"http://localhost"));//This uri is your SERVER ip.
    $soap->addFunction('minus_func');                                                 //Register the function
    $soap->addFunction(SOAP_FUNCTIONS_ALL);
    $soap->handle();
    function minus_func($i, $j){
        $res = $i - $j;
        return $res;
    }?>起动tomcat 运行:http://localhost/serverSoap.php 不知怎么?网上查了很多但我配置正确呀,求解
    Fatal error: Class 'SoapServer' not found in C:\AppServ\www\serverSoap.php on line 3