XMLRPC 不断为 CodeIgniter 抛出 500(特别是版本不匹配)

发布于 2024-12-02 16:54:03 字数 1555 浏览 3 评论 0原文

我一直在从事一个项目,该项目涉及连接到 SOAP 服务并从那里获取数据,而不是我可以直接访问的数据库。每当我访问此代码的页面时,我都会收到没有收到来自远程服务器的“200 OK”响应。 (HTTP/1.1 500 内部服务错误) 并在打开 debug 标志后,我看到

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Wrong Version</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

这是我的 SOAP 客户端的代码。

class Game_model extends CI_Model {
    function __construct()
    {
            $this->key = 'someKeyYouCantKnow:)';
            // Call model construct
            parent::__construct();
    }

    function check_key()
    {
            $this->load->library('xmlrpc');
            $this->xmlrpc->server('http://some.url.I.cant/share/entry.php', 80);
            $this->xmlrpc->method('checkKey');
            $request = array(
                    array('apiKey' => $this->key)
                    // Have tried encaps`ing in another array and specifying 
                    // as a struct as well, or leaving out 'apiKey' all together
            );
            $this->xmlrpc->request($request);
            $this->xmlrpc->set_debug(TRUE);
            if(!$this->xmlrpc->send_request())
            {
                    return $this->xmlrpc->display_error();
            }
            else return $this->xmlrpc->display_response();
    }
}

I've been working on a project that concerns connecting to a SOAP service and grab data from there rather than a DB I have direct access with. Whenever I go to the page for this code I receive Did not receive a '200 OK' response from remote server. (HTTP/1.1 500 Internal Service Error) and upon turning debug flag on I see

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Wrong Version</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

Here's the code for my SOAP client.

class Game_model extends CI_Model {
    function __construct()
    {
            $this->key = 'someKeyYouCantKnow:)';
            // Call model construct
            parent::__construct();
    }

    function check_key()
    {
            $this->load->library('xmlrpc');
            $this->xmlrpc->server('http://some.url.I.cant/share/entry.php', 80);
            $this->xmlrpc->method('checkKey');
            $request = array(
                    array('apiKey' => $this->key)
                    // Have tried encaps`ing in another array and specifying 
                    // as a struct as well, or leaving out 'apiKey' all together
            );
            $this->xmlrpc->request($request);
            $this->xmlrpc->set_debug(TRUE);
            if(!$this->xmlrpc->send_request())
            {
                    return $this->xmlrpc->display_error();
            }
            else return $this->xmlrpc->display_response();
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文