How to consume WebService returned DataTable from ASP.net with PHP -
i want know, how "consume" datatable returned in asp.net webservice method.
i work on examples:
asp.net webservice:
[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 command object identifying // stored procedure sqlcommand cmd = new sqlcommand( "dbo.sp_iskanje", conn); //here stored procedure works 100% // 2. set command object knows // execute stored procedure cmd.commandtype = commandtype.storedprocedure; // 3. add parameter command, // passed stored procedure cmd.parameters.add( new sqlparameter("@myinput", search)); // execute 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 console return dt; }
if call webservice in asp.net works fine & results datatable loop.
now how can datatable webservice can show/echo in php?
so far have in php file this: (btw: if call default helloworld() webservice method asp.net in php works great)
$client = new soapclient("http://localhost:10994/webservice.asmx?wsdl"); $params->param1 = "car"; //this search variable $result = $client->searchdatabase($params)->searchdatabaseresult; print_r ($result);
and result is:
did try this:
$params->search = "car"; //this search variable
it's working nice me, don't know how work rows , columns :-(
Comments
Post a Comment