目前,我正在使用 atry-catch
来确定 Web 服务是否可调用:
try {
WebServices::create($this->nameWS);
}
catch (Exception $e) {
var_dump($e);
}
现在,$e
包含错误消息以及包含数组的对象,如下所示。
注意:看似随机"
的第三行下方又接近尾声。
我确定您可以看到我要获取的字符串 - 这是我在代码中留下的唯一一个 - “GetMeService”(它在["class"]=>
里面[3]
)
object(SoapFault)#304 (8) {
["message:protected"]=>
string(182) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/examplewsdl' : failed to load external entity "http://localhost:8080/examplewsdl"
"
["string:private"]=>
string(0) ""
["code:protected"]=>
int(0)
["file:protected"]=>
string(71) ""
["line:protected"]=>
int(87)
["trace:private"]=>
array(8) {
[0]=>
array(6) {
["file"]=>
string(71) ""
["line"]=>
int(87)
["function"]=>
string(10) ""
["class"]=>
string(10) ""
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(49) ""
[1]=>
array(6) {
["trace"]=>
bool(true)
["features"]=>
int(1)
["login"]=>
NULL
["password"]=>
NULL
["proxy_host"]=>
string(13) ""
["proxy_port"]=>
int(80)
}
}
}
[1]=>
array(6) {
["file"]=>
string(71) ""
["line"]=>
int(41)
["function"]=>
string(15) ""
["class"]=>
string(18) ""
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
&object(WebServices)#292 (1) {
["_instanceWSCache"]=>
array(1) {
["eva"]=>
array(2) {
["type"]=>
string(4) "php5"
["params"]=>
array(4) {
["proxyhost"]=>
string(13) ""
["proxyport"]=>
int(80)
["wsdl"]=>
string(49) ""
["uri"]=>
string(24) ""
}
}
}
}
[1]=>
string(7) ""
}
}
[2]=>
array(6) {
["file"]=>
string(79) ""
["line"]=>
int(22)
["function"]=>
string(6) ""
["class"]=>
string(18) ""
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
string(7) ""
}
}
[3]=>
array(6) {
["file"]=>
string(82) ""
["line"]=>
int(218)
["function"]=>
string(6) ""
["class"]=>
string(14) "GetMeService"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
["faultstring"]=>
string(182) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/examplewsdl' : failed to load external entity "http://localhost:8080/examplewsdl"
"
["faultcode"]=>
string(4) "WSDL"
}
无论我尝试var_dump
用(例如var_dump($e=>["trace:private"][3]["class"]);
)替换我的什么,我都无法访问该字符串。可能吗?