Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET PHP WebService
Hi all
I have a ASMX web service that query a SQL Server 2008 and must return it's results as a table.
i want to use this web service in a PHP web application.
my question is how to transfer a table over a web serivce
please help me out
 
Best Regards
abforce
Posted 10-Apr-13 5:39am
abforce389
Comments
jkirkerx at 10-Apr-13 13:30pm
   
That depends on a couple of factors,
 
You can create a universal web service in asp.net, that can be accessed by PHP or whatever from a different domain.
 
But if your talking about using PHP and Jquery in a different domain, that gets a bit more tricky, because if the cross domain security issues.
 
As far as the table goes, I assume your talking about the entire table of columns, so I would personally use JOSN for a JQuery Request, or XML or WSDL for a cross domain request.
 
You should improve your question and add those details to get the right answer.
Kschuler at 10-Apr-13 13:57pm
   
..I might be making this up...but I don't think that you can return a datatable. Something about it not being serializeable. You have to put the datatable in a dataset and return the dataset, which is someone serializeable even though it contains a non-serializeable datatable. I can't remember the details, just remember running into that when I created an asmx webservice years ago. But maybe it's different because my client side wasn't PHP.
Kschuler at 10-Apr-13 14:00pm
   
I googled and found a post where someone said that .Net 2 made the DataTable Serializable. So...ignore me.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I'm going to suggest using a ASHX page and soap since your using PHP to access the service, and I assume that a request with proper credentials from any domain can use the service.
 
Basically you write a WSDL file that defines your table request, and different possible responses that you may send back such as faults, warnings, errors, and the actual data requested.It's like XML, or sort of like XSD.
 
Then you write a class to receive the SOAP request, access the database, package the data, send back the response.
 
Now you register that class on the ASHX page, and place the page on the web server.
 
I could not find any easy to understand examples of the whole process, but found some simple examples, and talk about the subject.
 
http://www.dotnetperls.com/ashx[^]
 
http://blog.beacontechnologies.com/using-net-ashx-handlers-to-build-web-services-2/[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100