Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help writing Web Services in ColdFusion

Status
Not open for further replies.

spook007

Programmer
Joined
May 22, 2002
Messages
259
Location
US
I've written a CFC code that I would like to access as a web service.

<cfcomponent>
<cffunction name=&quot;getDBList&quot; access=&quot;remote&quot; returntype=&quot;query&quot;>
<cfset qResults=&quot;&quot;>
<cfquery name=&quot;DBList&quot; datasource=&quot;stewlib&quot;>
SELECT ARTICLE_ID, ARTICLE_NAME, ARTICLE_DESCRIPTION, ARTICLE_LINK
FROM LIBRARY.ARTICLE
ORDER BY ARTICLE_NAME ASC
</cfquery>
<cfreturn qResults>
</cffunction>
</cfcomponent>

It works just fine in DW, it's a pretty straight forward CFC. When I look at what the Service returns, it is a single array with all the data inside it. I've seen some other Web Services that send the results as a whole array and as individual fields as well. How can I change my code so that I can have ColdFusion send the individual field info as well? Thanks.
 
You write additional functions with appropriate returntype attributes.

I'm not sure what &quot;individual field info&quot; you're after, by, say, if you wanted the web service to return the article ID, you'd write an additional function called &quot;getArticleID&quot; or whatever, that would return a string or whatever.

Is that what you mean?


-Carl
 
I've been doing some reading and I think I'm getting closer to what I'm looking for. It's tough to explain if you don't really understand how this works. I think what I'm after is CFPROPERTY.

I'm trying to do a Web Service, because I'm trying to populate my components in Flash MX 2004. In order for me to be able to populate my components I have to be able to capture the values from the individual fields. There are examples out there of other Web Services like ( that send optional field info (like CompanyName, StockQuote, StockTicker, etc.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top