Obviously you will want to create more sophisticated web services that offer more than string literals. Now you will add a function to the CFC that returns query data.
Add another function to the CFC with the following attributes:
As a best practice, create a variable local to the function using the cfset tag:
<cfset var qBikeParts="">
<cfquery name="qBikeParts" datasource="devnetws"> SELECT name, description, price FROM Parts ORDER BY name </cfquery>
Return the query using a cfreturn tag:
<cfreturn qBikeParts>
Ensure your new function appears as follows:
<cffunction name="returnquery" access="remote" returntype="query"> <cfset var qBikeParts=""> <cfquery name="qBikeParts" datasource="devnetws"> SELECT name, description, price FROM Parts ORDER BY name </cfquery> <cfreturn qBikeParts> </cffunction>
?wsdl parameter appended to the URL as follows: http://127.0.0.1:8500/devnet/ws/Simple.cfc?wsdl to ensure you are not receiving any errors.