Link to home
Start Free TrialLog in
Avatar of nonesuch
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"?>
<SOAP-ENV:Envelope
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:si="http://soapinterop.org/xsd">
 <SOAP-ENV:Body>
  <ns1:helloResponse xmlns:ns1="http://tempuri.org">
   <return xsi:type="xsd:string">Hello, Scott</return>
  </helloResponse>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

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.



<listing>
<item>
<sku>1</sku>
<item_name>shirt</item_name>
<item_color>blue</item_color>
</item>
<item>
<sku>2</sku>
<item_name>jacket</item_name>
<item_color>green</item_color>
</item>
</listing>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of nonesuch
nonesuch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial