Generic Database Access
| From: | Rob Booth | Date: | Fri, 01 Aug 2003 21:18:39 +0000 |
| Subject: | Generic Database Access | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-913@lists.php.net to get a copy of this message | ||
Has anyone tried this yet?
I'm wondering how I would go about building a Web Service that would allow
me to run a query against my database and get back a result set. I don't
really want to get by every row/col wrapped in SOAP because this overhead
would be unwieldly. Is there a more elegant solution that I'm just not
seeing? I was thinking that I could build my own return structure and wrap
it in a single SOAP tag then parse the structure to re-build the row/col
structure on the client side, but this also seems wrong. Any thoughts or
ideas are more than welcome.
So in example I'd like to be able to send this, or any other, query to my
database:
SELECT name, address1, address2, city, state, zip
FROM users
And get back my results, but not in a huge SOAP structure like the one below
(only 1 row shown)
<Result xsi:type="ns4:QueryResult">
<Rows xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[100]"
SOAP-ENC:offset="[0]">
<item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[6]"
SOAP-ENC:offset="[0]">
<item xsi:type="xsd:string">Rob</item>
<item xsi:type="xsd:string">1234 Main St.</item>
<item xsi:type="xsd:string">Suite 123</item>
<item xsi:type="xsd:string">AnyTown</item>
<item xsi:type="xsd:string">AnyState</item>
<item xsi:type="xsd:string">92837</item>
</item>
As you can see this would get to be very large with only a few rows, imagine
it with thousands of rows. So I'm hoping that there is an easier/nicer way
to return unknown data from a database using a Web Service.
Thanks,
Rob