Avatar of nonesuch

asked on 

Create web service to return output of query

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

PHPWeb Services

Avatar of undefined
Last Comment

8/22/2022 - Mon