mikey999 wrote:
> 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
>
>
>
The <cfcomponent...>...</cfcomponent> code should
be in a file with a
.cfc extension, this is not required, but it is the default
expectation.
The <cfinvoke...> tag should be in an .cfm file. It
could also be in a
higer level cfc, but let's not get ahead of ourselves here.
The
"webservice" parameter of the <cfinvoke...> tag should
reference the cfc
file created above.
Before running your cfc as a web service run it as a
component. Just
add a component version of <cfinvoke...> before your
web service
version. This makes sure that errors in the cfc itself is not
stopping
you dead in your tracks. A web service can not always report
the same
level of detail about an error as a component called locally
can.