Yes, that is what a webservice is used for and yes, that approach will work. With webservices though, do your best to make sure you're not exposing information about your database so people can't learn too much about your infrastructure without even having to dig. So you might alias column names and mask id's...do whatever you can to obfuscate your meta data.
One other thing to consider - Coldfusion's webservice returns of Queries aren't the friendliest to work with because of how they return the structure - basically they return the columnlist in an array, and then they return the data in an array of arrays. So you might want to look into any solutions that people have come up with to translate a CFC webservice into a PHP readable format. Also, I would like to suggest (seeing as how this is your first attempt at a webservice), returning the data in a json format. The short of it is that JSON is easier to work with in just about every web scripting language out there now. It's data size is GREATLY reduced from that of XML, and if you ever want to move towards ajax, it will make your life quite a bit easier. If you have CF8 on the box, that will be pretty easy to do by calling your CFC with a returnFormat=json. If you're using a version prior to 8, you might want to look into a couple of CFC's that have been created by various people out there. CFJson.cfc: http://www.epiphantastic.com/cfjson/ Hope that helps a little. Allen ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Dusty Hale Sent: Thursday, April 16, 2009 1:01 AM To: [email protected] Subject: [ACFUG Discuss] creating a web service with cf I have a need which I think would be a good fit to create a web service but since I have never developed a web service I thought to get some other opinions. I have a site which is hosted on a Linux box with php and no CF. I need for part of this site to use a database and make a little admin app to manage it. Well I am lazy and don't want to do this with PHP and MySQL mainly because I know CF and SQL so I just want to do this with what I am used to. So my thought was that I could create a CFC that would act as a web service that the PHP site could call remotely. All it needs to do is get some data from the SQL server and display it in HTML. So I though I could generate the result HTML in the CFC and the PHP site could call it remotely. Again the PHP site is not on the same server as the CFC so it would be a remote call. This is basically what a web service is for right? Would this approach work? Thanks so much in advance for any replies. Dusty ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
