如何在PHP中读取.NETWeb服务?
我已经成功地阅读了WSDL表单SoapClient。我尝试以下方法将值传递给web方法并读取结果:如何在PHP中读取.NETWeb服务?,php,.net,web-services,Php,.net,Web Services,我已经成功地阅读了WSDL表单SoapClient。我尝试以下方法将值传递给web方法并读取结果: $client = new SoapClient("restaurant.asmx?wsdl"); $param = array('search_keywords'=>$search_text); $result = $client->__soapCall('getRestaurantsASP',$param); print_r($result); 我得到了这个错误: F
$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方法发送参数并检索值?正如DaveRandom所建议的,问题似乎在服务本身,而不是在用于服务的SQL查询中 尝试使用SoapUI,您可以从那里下载它并执行服务方法 SoapUI是测试Web服务的中立客户端 希望能有所帮助。我不得不补充:
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
<add name="HttpSoap"/>
</protocols>
</webServices>
在Web.config文件中,以使事情正常运行 在我看来,这似乎是服务器端的一个问题,特别是SQL查询的问题。但当我使用测试页测试它时,它返回的值很好。