Click here to Skip to main content
13,056,229 members (82,120 online)
Rate this:
Please Sign up or sign in to vote.
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
Posted 10-Apr-13 4:39am
jkirkerx 10-Apr-13 13:30pm
That depends on a couple of factors,

You can create a universal web service in, 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 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 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
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.[^][^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.2 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2017
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