简体   繁体   English

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

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

I'm new at this soap server. 我是这个肥皂服务器的新手。 I user codeigniter to build a server web services. 我用用户codeigniter来构建服务器Web服务。 in my controller Serverservices.php i write 在我的控制器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() {}
}
?>

When i enter url http://web.mysite.com/serverservices?wsdl nothing happen. 当我输入网址http://web.mysite.com/serverservices?wsdl时,什么都没有发生。 It do not show my wsdl file. 它不显示我的wsdl文件。 But i can download my wsdl file if i access http://web.mysite.com/assets/wsdl/test.wsdl . 但是,如果我访问http://web.mysite.com/assets/wsdl/test.wsdl,我可以下载wsdl文件。

Any one can help? 有人可以帮忙吗? do i need to compile the wsdl? 我需要编译wsdl吗? How can i compile the wsdl? 我如何编译wsdl?

i use nginx on ubuntu 16.04 and php7.0 我在ubuntu 16.04和php7.0上使用nginx

Move your WSDL code inside the index method. 将WSDL代码移到index方法中。 You are only specifying a controller on the url but you have not specified a method so it will call index method by default. 您仅在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() {}
}

You can also use this library which adds nuSoap to CodeIgniter 您还可以使用此库, 它将nuSoap添加到CodeIgniter

I try to access http://web.mysite.com/serverservices?wsdl and it return nothing. 我尝试访问http://web.mysite.com/serverservices?wsdl ,但未返回任何内容。 i see in log it shows like this 我在日志中看到它像这样显示

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:"-"

I try to access directly http://web.mysite.com/assets/wsdl/test.wsdl and it return XML body and it show this in the log 我尝试直接访问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:"-"

I try to access http://web.mysite.com/serverservices?test.wsdl and it return nothing. 我尝试访问http://web.mysite.com/serverservices?test.wsdl ,但未返回任何内容。 i see in log it shows like this 我在日志中看到它像这样显示

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:"-"

Anyone have resources to understand this log? 有人有资源了解此日志吗? Because i think from that log my soapserver is working fine. 因为我认为从该日志中我的soapserver运行正常。 It tried to retrieve assets/wsdl/test.wsdl. 它尝试检索资产/wsdl/test.wsdl。 But no XML body returned. 但是没有XML主体返回。 Or anyone know how to setup php native soapserver with fast cgi? 还是有人知道如何使用快速CGI来设置PHP本机soapserver? because the only difference between my local and server is nginx and fastcgi 因为我的本地服务器和服务器之间的唯一区别是nginx和fastcgi

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

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