這篇文章介紹的內容是關於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()); }
客戶端和伺服器端都加上具體的位址才行
相關推薦:
以上是php5.5.12 下調試 SOAP 報錯訊息的詳細內容。更多資訊請關注PHP中文網其他相關文章!