0

我已成功阅读 WSDL 表单 SoapClient。我尝试将值传递给 web 方法并读取结果:

 $client = new SoapClient("restaurant.asmx?wsdl");
 $param = array('search_keywords'=>$search_text); 
 $result =  $client->__soapCall('getRestaurantsASP',$param);
 print_r($result);

我收到了这个错误:

Fatal error: Uncaught SoapFault exception: [soap:Server]
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> 
System.Data.SqlClient.SqlException: Invalid object name 'basic_info_table'. at 
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean   
breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 
exception, Boolean breakConnection) at 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at 
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, 
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject 
stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at 
System.Data.SqlClient.SqlDataReader.get_MetaData() at 
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior 
runBehavior, String resetOptionsString) at 
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, 
RunBehavior runBehavior in E:\webareas\gs937\aspservice.php on line 73

如何将参数发送到 Web 方法并检索值?

4

2 回答 2

0

正如 DaveRandom 所建议的,问题似乎出在服务本身,而问题出在用于服务的 SQL 查询中。

尝试使用 SoapUI(您可以从http://sourceforge.net/projects/soapui/files/下载它)并从那里执行服务方法。

SoapUI 是用于测试 Web 服务的中立客户端。

希望它会有所帮助。

于 2012-04-27T12:09:19.643 回答
0

我不得不补充:

<webServices>
<protocols>
  <add name="HttpGet"/>
  <add name="HttpPost"/>
  <add name="HttpSoap"/>
</protocols>
</webServices>

在 Web.config 文件中以使事情正常进行。

于 2012-04-29T19:14:58.190 回答