Home  >  Article  >  Backend Development  >  Debugging SOAP error messages under php5.5.12

Debugging SOAP error messages under php5.5.12

不言
不言Original
2018-04-28 09:03:352088browse

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

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();
    }

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());
        }

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']);
    }
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());
        }

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!

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