php5.5.12 下調試 SOAP 報錯訊息

不言
發布: 2023-03-25 06:08:01
原創
2050 人瀏覽過

這篇文章介紹的內容是關於php5.5.12 下調試SOAP 報錯信息,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下

今天用soap調試的時候,一直出現如下錯誤

{
    "respcode": 202,
    "respmsg": "looks like we got no XML document",
    "data": ""
}
登入後複製

找了各種方法沒解決,我的程式碼如下:

伺服器端:

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();
    }
登入後複製

客戶端呼叫:

$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());
        }
登入後複製

在php5.4.44環境下就能成功拿到數據,但在php5.5.12就會一直報錯

最後,在php5.5.12環境下,將配置uri 補全,問題解決

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());
        }
登入後複製

客戶端和伺服器端都加上具體的位址才行

相關推薦:

##PHP透過SOAP實作WebService



以上是php5.5.12 下調試 SOAP 報錯訊息的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!