Debugging SOAP error messages under php5.5.12

不言
Release: 2023-03-25 06:08:01
Original
2087 people have browsed it

The content of this article is about debugging SOAP error messages under php5.5.12. It has a certain reference value. Now I share it with you. Friends in need can refer to it.

When debugging with soap today , the following error keeps appearing

{
    "respcode": 202,
    "respmsg": "looks like we got no XML document",
    "data": ""
}
Copy after login

I have found various methods but cannot solve it. My code is as follows:

Server side:

function __construct()
    {
        parent::__construct();
        $this->load->model('baogaolist');
        $this->server = new SoapServer(null, ['uri' => '']);
    }

    function checkreport()
    {
        $this->load->model('baogaolist');
        $this->server->setObject($this->baogaolist);
        $this->server->handle();
    }
Copy after login

Client call:

$url = $this->config->item('car_battery_check_url');

        //获取信息地址
        try {
            $a = new SoapClient(null, [
                'location' => $url . '/report/checkreport',
                'uri' => ''
            ]);

            $detail = $a->get_detail($this->storeid, $check_id);

        } catch (SoapFault $e) {
            resp_msg(202,$e->getMessage());
        }
Copy after login

In the php5.4.44 environment, the data can be successfully obtained, but in php5.5.12, errors will always be reported

Finally, in the php5.5.12 environment, complete the configuration uri and solve the problem

function __construct()
    {
        parent::__construct();
        $this->load->model('baogaolist');
        $this->server = new SoapServer(null, ['uri' => 'http://172.16.4.29:8000/index.php/report/checkreport']);
    }
Copy after login
try {
            $a = new SoapClient(null, [
                'location' => $url . '/report/checkreport',
                'uri' => 'http://172.16.4.29:8000/index.php/report/checkreport'
            ]);

            $detail = $a->get_detail($this->storeid, $check_id);

        } catch (SoapFault $e) {
            resp_msg(202,$e->getMessage());
        }
Copy after login

Only add specific addresses to both client and server

Related recommendations:

PHP implements WebService through SOAP



The above is the detailed content of Debugging SOAP error messages under php5.5.12. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!