douchengjue9892 2017-08-03 08:40
浏览 75

如何使用php设置SOAP客户端和服务器

i have some problems with the soap client and soap server.

server.php on server side

class Server {
    public function hello($someone) {
        return "Hello ". $someone;
    }
}
$options= array('uri'=>'http://localhost/');
$server=new SoapServer(NULL, $options);
$server->setClass('Server');
$server->handle();

index.php on client side

<?php
$options = array('location' => 'http://localhost/server.php',
                    'uri' =>'http://localhost/');
$client = new SoapClient(NULL, $options);
echo $client->hello('Greg'); 

I'm testing this local on xampp and get the Error: What do i make wrong ? Can i test it localy or do i have to set up a server for this. If yes, is it possible to run this on IIS ?

Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in C:\xampp\htdocs\SOAP\index.php:8 Stack trace: #0 [internal function]: SoapClient->__doRequest('http://localhos...', 'http://localhos...', 1, 0) #1 C:\xampp\htdocs\SOAP\index.php(8): SoapClient->__call('hello', Array) #2 C:\xampp\htdocs\SOAP\index.php(8): SoapClient->hello('Greg') #3 {main} thrown in C:\xampp\htdocs\SOAP\index.php on line 8

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料