Skip to main content
Known Participant
October 6, 2008
Question

Web Service

  • October 6, 2008
  • 12 replies
  • 1460 views
hi,

i am trying to learn how to do a web service.

I used this example to figure this out
http://www.quackit.com/coldfusion/tutorial/coldfusion_web_services.cfm

my code is here
http://www.climatetech.net/cti_webservice/Test_WebService.cfm

Code
===============================================

<cfinvoke
method="listBooks"
returnvariable="rawXMLFileList"
webservice=" http://www.climatetech.net/WebService.cfc?wsdl">

<cfinvokeargument name="category" value="123">
</cfinvoke>

<cfset FilesXML = XmlParse(rawXMLFileList)>

<cfdump var="#FilesXML#">

========================================
and my cfc file is here
http://www.climatetech.net/cti_webservice/WebService.cfc

code



<cfcomponent>
<cffunction name="listBooks"
access="remote"
returntype="string"
output="no">

<cfargument name="category"
type="string"
required="yes">

<cfset Var FileList = "">
<cfset Var getBooks = "">
<cfquery name="getBooks" datasource="DS" maxrows=100 dbtype="ODBC">
SELECT FileToolID,FileTitle, FileDescription, File3
FROM FileTool
Where FileTool.StatusID = 'Approved'
AND FileTool.FileCONFIGID = 24
</cfquery>
<cfsavecontent variable="FileList">
<Files>
<cfoutput query="getBooks">
<File id="#FileToolID#">
<Filetitle>#XMLFormat(FileTitle)#</Filetitle>
<FileLink> http://www.resourcesaver.org/file/toolmanager/#XMLFormat(File3)#</FileLink>
<Description>#XMLFormat(FileDescription)#</Description>
</File>
</cfoutput>
</Files>
</cfsavecontent>

<cfreturn FileList>
</cffunction>
</cfcomponent>


=========================================================

this is really basic but for some reason i can not get this to work. has any one set one of these up and made it work before. i have never done this before but i figure get a basic example working first to understand this.
This topic has been closed for replies.

12 replies

Inspiring
October 6, 2008
Your first sentence in your OP is "I am trying to learn how to do a webservice." I suggest taking baby steps.

Don't advance to a step until the previous step has been successfully completed.

Step 1.
Write a cfc with one function that accepts no arguments and returns a simple string, like "Hello World".
Step 2.
Invoke it as a cfc
Step 3
Invoke it as a webservice.
Step 4.
Add another function to the cfc that takes a string argument, and returns it.
Step 5.
Invoke it as a cfc
Step 6
Invoke it as a webservice.

You then start building the one you really want. I forget the details, but you might have to refresh your stub objects from time to time.
Inspiring
October 6, 2008
In what way does it not work?
mikey999Author
Known Participant
October 6, 2008
sorry when you run this page

http://www.climatetech.net/cti_webservice/Test_WebService.cfm

i get this error


Could not generate stub objects for web service invocation.
Name: http://www.climatetech.net/WebService.cfc?wsdl. WSDL: http://www.climatetech.net/WebService.cfc?wsdl. org.xml.sax.SAXException: Fatal Error: URI=null Line=30: The string "--" is not permitted within comments. It is recommended that you use a web browser to retrieve and examine the requested WSDL document for correctness. If the requested WSDL document can't be retrieved or it is dynamically generated, it is likely that the target web service has programming errors.

The error occurred in D:\web\customers\CTI\cti_webservice\Test_WebService.cfm: line 6

4 : webservice=" http://www.climatetech.net/WebService.cfc?wsdl">
5 :
6 : <cfinvokeargument name="category" value="123">
7 : </cfinvoke>
8 :