We help IT Professionals succeed at work.
Get Started

Create web service to return output of query

nonesuch asked
Last Modified: 2012-05-06
I am fairly certain this is a simple task, but I can't find a simple example anywhere. What I want to do is create a web service (on PHP) that accepts various parameters that are used to build and execute a SQL query and return a set of data.  I want the XML response to be returned something like the attached code.

I am looking for a response with some example code of how to accomplish exactly this. Please please don't reply with some link to a web site introducing XML (read 'em), because then no one else will respond to the question. I have found tons of code and examples that produce something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <ns1:helloResponse xmlns:ns1="http://tempuri.org">
   <return xsi:type="xsd:string">Hello, Scott</return>

That's not what I need. Unless you're going to tell me (clearly) how I convert that to look like the output below. I will be happy to reward points for a complete answer. If you have some example PHP service code laying around and want to send it to me, I can just modify it to do what I want.  I just need an example that does what I need, because I am not making forward progress on my current attempts.

I've read other comments with "REST" and that sort of thing, again, if you can provide a clear explanation of code examples that accomplish what I want, great, but otherwise, all I know is I have XML extensions and SOAP extensions installed and working and I can get the XML service to return stuff but it's not in that type of cleaned up format... and that's what I need.


Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE