繁体   English   中英

使用codeigniter构建soapserver。 网址不显示wsdl文件

[英]build soapserver using codeigniter. url do not show wsdl file

我是这个肥皂服务器的新手。 我用用户codeigniter来构建服务器Web服务。 在我的控制器Serverservices.php中,我写了

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled", "0");

$server = new SOAPServer("http://web.mysite.com/assets/wsdl/test.wsdl");
$server->setClass('Serverservices');
$server->handle();

class Serverservices extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function index() {}
    public function other() {}
}
?>

当我输入网址http://web.mysite.com/serverservices?wsdl时,什么都没有发生。 它不显示我的wsdl文件。 但是,如果我访问http://web.mysite.com/assets/wsdl/test.wsdl,我可以下载wsdl文件。

有人可以帮忙吗? 我需要编译wsdl吗? 我如何编译wsdl?

我在ubuntu 16.04和php7.0上使用nginx

将WSDL代码移到index方法中。 您仅在url上指定了一个控制器,但没有指定方法,因此默认情况下它将调用index方法。

class Serverservices extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function index() {
        ini_set("soap.wsdl_cache_enabled", "0");

        $server = new SOAPServer("http://web.mysite.com/assets/wsdl/test.wsdl");
        $server->setClass('Serverservices');
        $server->handle();
    }

    public function other() {}
}

您还可以使用此库, 它将nuSoap添加到CodeIgniter

我尝试访问http://web.mysite.com/serverservices?wsdl ,但未返回任何内容。 我在日志中看到它像这样显示

xxx.xxx.xxx.72 - - [02/Feb/2018:10:36:46 +0700] "GET /assets/wsdl/test.wsdl HTTP/1.1" 200 11700 "-" "-" 0.001 req_body:"-"
xxx.xxx.xxx.xxx - - [02/Feb/2018:10:36:46 +0700] "GET /serverservices?wsdl HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" 0.223 req_body:"-"

我尝试直接访问http://web.mysite.com/assets/wsdl/test.wsdl ,它返回XML正文,并在日志中显示

xxx.xxx.xxx.xxx - - [02/Feb/2018:10:39:41 +0700] "GET /assets/wsdl/test.wsdl HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" 0.000 req_body:"-"

我尝试访问http://web.mysite.com/serverservices?test.wsdl ,但未返回任何内容。 我在日志中看到它像这样显示

xxx.xxx.xxx.72 - - [02/Feb/2018:10:43:50 +0700] "GET /assets/wsdl/test.wsdl HTTP/1.1" 200 11700 "-" "-" 0.000 req_body:"-"
xxx.xxx.xxx.xxx - - [02/Feb/2018:10:43:50 +0700] "GET /serverservices?test.wsdl HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" 0.004 req_body:"-"

有人有资源了解此日志吗? 因为我认为从该日志中我的soapserver运行正常。 它尝试检索资产/wsdl/test.wsdl。 但是没有XML主体返回。 还是有人知道如何使用快速CGI来设置PHP本机soapserver? 因为我的本地服务器和服务器之间的唯一区别是nginx和fastcgi

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM