[英]Error with Client Web Service Soap
I have my web service which I am sure is good because I have been using almost the same code for another project. 我有我的Web服务,我相信它很好,因为我一直在使用几乎相同的代码用于另一个项目。
<?php
try
{
$input=$_POST['txtInput'];
$wsdl='http://localhost/Search.wsdl';
$options=array('cache_wsdl'=>WSDL_CACHE_NONE,'features'=>SOAP_SINGLE_ELEMENT_ARRAYS);
echo "hi1";
$client=new SoapClient($wsdl,$options);
echo "hi2";
$response=$client->viewHealth($input);
echo "hi3";
if(isset($response->Health))
{
$HTMLDocument="<!Doctype html>
<html>
<head>
<title>Health</title>
<link rel='stylesheet' type='text/css' href='style.css'/>
</head>
<body>
<table border='2'>
<thead>
<tr id='tabs'>
<th>Title</th>
<th>Description</th>
<th>Symptoms</th>
<th>Treatments</th>
</tr>
</thead>
<tbody>";
foreach($response->Health as $record)
{
$HTMLDocument.="<tr><td>".$record->Title."</td>";
$HTMLDocument.="<td>".$record->Description."</td>";
$HTMLDocument.="<td>".$record->Symptoms."</td>";
$HTMLDocument.="<td>".$record->Treatments."</td></tr>";
}
$HTMLDocument.="</tbody></table></body></html>";
echo $HTMLDocument;
}
else
{ }
}
It is echoing hi1, but not echoing hi2, hi3. 它回荡hi1,但不回应hi2,hi3。 I have no idea what is wrong. 我不知道出了什么问题。 Can someone please help? 有人可以帮忙吗?
Add a 添加一个
catch (Exception $e) {
echo $e->getMessage();
}
After your try{} to see what exception is thrown. 尝试{}后看看抛出了什么异常。 I would assume that the wsdl is not reachable. 我会假设wsdl无法访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.