Question
web service
so i have never created a web service and find my self
wanting to learn how. So I found this page with examples
http://www.quackit.com/coldfusion/tutorial/coldfusion_web_services.cfm
i followed the example and built my own script just changing out my database info so it would use my data.
here is my data
<cfcomponent>
<cffunction name="listBooks"
access="remote"
returntype="string"
output="no">
<cfargument name="category"
type="string"
required="yes">
<cfset Var BookList = "">
<cfset Var getBooks = "">
<cfquery name="getBooks" datasource="datasource">
SELECT FileToolID,FileTitle, UrlLink, FileDescription, File3
FROM FileTool
AND FileTool.StatusID = 'Approved'
AND FileTool.FileCONFIGID = 24
</cfquery>
<cfsavecontent variable="BookList">
<books>
<cfoutput query="getBooks">
<book id="#FileToolID#">
<booktitle>#XMLFormat(FileTitle)#</booktitle>
<teaser>#XMLFormat(UrlLink)#</teaser>
<price>#XMLFormat(FileDescription)#</price>
</book>
</cfoutput>
</books>
</cfsavecontent>
<cfreturn BookList>
</cffunction>
</cfcomponent>
i tried to then run this script
<cfinvoke
method="listBooks"
returnvariable="rawXMLBookList"
webservice=" http://yourdomain.com/web_services/book.cfc?wsdl">
<cfinvokeargument name="category" value="123">
</cfinvoke>
<cfset computerBooks = XmlParse(rawXMLBookList)>
<cfdump var="#computerBooks#">
and i get nothing but an error. the part i do not get is my first file is called test.cfm do i need to cal lit test.cfc? or does it create a file called test.cfm
this part confuses me.
thanks much
http://www.quackit.com/coldfusion/tutorial/coldfusion_web_services.cfm
i followed the example and built my own script just changing out my database info so it would use my data.
here is my data
<cfcomponent>
<cffunction name="listBooks"
access="remote"
returntype="string"
output="no">
<cfargument name="category"
type="string"
required="yes">
<cfset Var BookList = "">
<cfset Var getBooks = "">
<cfquery name="getBooks" datasource="datasource">
SELECT FileToolID,FileTitle, UrlLink, FileDescription, File3
FROM FileTool
AND FileTool.StatusID = 'Approved'
AND FileTool.FileCONFIGID = 24
</cfquery>
<cfsavecontent variable="BookList">
<books>
<cfoutput query="getBooks">
<book id="#FileToolID#">
<booktitle>#XMLFormat(FileTitle)#</booktitle>
<teaser>#XMLFormat(UrlLink)#</teaser>
<price>#XMLFormat(FileDescription)#</price>
</book>
</cfoutput>
</books>
</cfsavecontent>
<cfreturn BookList>
</cffunction>
</cfcomponent>
i tried to then run this script
<cfinvoke
method="listBooks"
returnvariable="rawXMLBookList"
webservice=" http://yourdomain.com/web_services/book.cfc?wsdl">
<cfinvokeargument name="category" value="123">
</cfinvoke>
<cfset computerBooks = XmlParse(rawXMLBookList)>
<cfdump var="#computerBooks#">
and i get nothing but an error. the part i do not get is my first file is called test.cfm do i need to cal lit test.cfc? or does it create a file called test.cfm
this part confuses me.
thanks much