$client = new SoapClient($wsdl, array('encoding' => 'utf-8'));现在有这么个情况;服务调通了之后,我发送了需要处理的数据,处理成功后会返回成功值,我会在页面用ajax弹出成功提示,处理失败后返回的失败我也会提示,但是,如果webservice接口不通,远程服务挂掉了,我也需要一个失败提示,但是不能和之前连通后处理失败的提示一样,请问怎么样才能判定SoapClient没有调通对方的接口呢?
提醒一下,对方服务挂掉的时候,返回的是404报错。
以下是response结果:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>系统发生错误</title>
<style type="text/css">
*{ padding: 0; margin: 0; }
html{ overflow-y: scroll; }
body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }
img{ border: 0; }
.error{ padding: 24px 48px; }
.face{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
h1{ font-size: 32px; line-height: 48px; }
.error .content{ padding-top: 10px}
.error .info{ margin-bottom: 12px; }
.error .info .title{ margin-bottom: 3px; }
.error .info .title h3{ color: #000; font-weight: 700; font-size: 16px; }
.error .info .text{ line-height: 24px; }
.copyright{ padding: 12px 48px; color: #999; }
.copyright a{ color: #000; text-decoration: none; }
</style>
</head>
<body>
<div style="width:1000px;height:200px;margin:100px auto;border:1px solid blue;text-align:center;line-height:200px;">
<h2>无法加载页面</h2>
</p>
</body>
</html>这种情况下,try catch $client没用, 最佳答案