newjordanshoesce
New Member
I want to know, how to properly "consume" DataTable which is returned in ASP.net WebService method.I work on this examples:ASP.net WEBSERVICE:\[code\][WebMethod]public DataTable searchDatabase(string search){ SqlConnection conn = null; SqlDataReader rdr = null; conn = new SqlConnection("Data Source=ASUSX301A\\MSSQLINSTANCE;Initial Catalog=db_sp_vaje;Integrated Security=True;Pooling=False"); conn.Open(); // 1. create a command object identifying // the stored procedure SqlCommand cmd = new SqlCommand( "dbo.sp_iskanje", conn); //here is my stored procedure which works 100% // 2. set the command object so it knows // to execute a stored procedure cmd.CommandType = CommandType.StoredProcedure; // 3. add parameter to command, which // will be passed to the stored procedure cmd.Parameters.Add( new SqlParameter("@myInput", search)); // execute the command SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataTable dt = new DataTable(); dt.TableName = "oglasi"; dt.WriteXml(@"path", true); da.Fill(dt); // iterate through results, printing each to console return dt; }\[/code\]If I call this webservice also in ASP.net works fine & I get results from datatable with loop. Now how can I get this datatable from webservice that I can show/echo in PHP?So far I have in my PHP file this: (BTW: if I call default HelloWorld() webservice method from ASP.net in PHP works great)\[code\]$client = new SoapClient("http://localhost:10994/WebService.asmx?WSDL");$params->Param1 = "car"; //this is search variable$result = $client->searchDatabase($params)->searchDatabaseResult;print_r ($result);\[/code\]And result is: