PDA

View Full Version : WDDX not working packet it not returned....


Yippy-Ki-A
08-15-2004, 11:43 PM
Hello Members

I have this application; moreover flash 2004 MX that Aaron West helped me with. This was from an easy CFM tutorial here (Add a newsfeed to your site).

http://tutorial165.easycfm.com/

You can view the completed Cold Fusion Application here.

http://www.yippykia.com/news/index.cfm?NavigationID=News

the only problem is that the wddx packet does not return, from with in flash, you see this other fields that are remotely populated, but the final field is just returned as a text string from the database, and the wddx is not exchanged.

Maybe the text area is not a A.S. 2 component or something.

Took me a while to back pedal to find the source for the edited import mx.calls in first line.


Any tips would be helpful.

Here is the code for the flash file…

import mx.remoting.*;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();



//#include "NetDebug.as"
//#include "NetServices.as"
#include "wddx_mx.as"

var ColdFusion_Conn = NetServices.createGatewayConnection("http://localhost:8500/flashservices/gateway");
//neds to change according to where you park the files
var NewsService = ColdFusion_Conn.getService("ver4_fla.NewsService", this);

NewsService.getCategoriesName();

// getCategoryDetails Responder.
getCategoryDetails_Result = function(result) {
if (result != undefined) {
ta_newsDetails.htmlText = "";
for (var i:Number = 0; i<result.items.length; i++) {
ta_newsDetails.htmlText += "Category: " + result.items[i].Category + "<br>";
ta_newsDetails.htmlText += "Category Name: " + result.items[i].CategoryName + "<br>";
ta_newsDetails.htmlText += "Short Name: " + result.items[i].ShortName + "<br><br>";
ta_newsDetails.htmlText += result.items[i].FeedURL;
ta_newsDetails.htmlText += "<br><br>";
}
}
}

// getCategoriesTopics Responder.
getCategoriesTopics_Result = function(result) {
if (result != undefined) {
for (var i:Number = 0; i<result.items.length; i++) {
var thisLabel = result.items[i].CategoryName;
var thisData = result.items[i].ShortName;
lb_listCategories.addItem( { label: thisLabel, data: thisData} );
}
}
}

// Create a listener object for the lb_listCategories "change" handler.
var listBox = { };
listBox.change = function(evt) {
var shortName = evt.target.getItemAt(evt.target.selectedIndex).dat a;
NewsService.getCategoryDetails(shortName);
}
// Add the listBox object to lb_listCategories's listeners.
lb_listCategories.addEventListener("change", listBox);

// getCategoriesName Responder.
getCategoriesName_Result = function(result) {
if (result != undefined) {
for (var i:Number = 0; i<result.items.length; i++) {
var thisLabel = result.items[i].Category
cb_CategoriesTopics.addItem( { label: thisLabel, data: thisLabel } );
}
}
}

// Create a listener object for the cb_CategoriesTopics "change" event handler.
var dropDown = { };
dropDown.change = function (evt) {
var catName = evt.target.getItemAt(evt.target.selectedIndex).dat a;
NewsService.getCategoriesTopics(catName);
}
// Add the dropDown object to cb_CategoriesTopics's listeners.
cb_CategoriesTopics.addEventListener("change", dropDown);

//end of code

And here is the CFC that is utilized in the remote call

<!--- Start the ColdFusion Component --->
<cfcomponent name="NewsService">

<!--- :::Function: Retrieve List of Park TYPES (for DropDown)--->
<cffunction name="getCategoriesName" access="remote"
returnType="query">

<CFQUERY NAME="q_NewsCategories" Datasource="reboot">
SELECT Distinct (Category)FROM news
WHERE Category is not NULL
ORDER BY Category
</CFQUERY>
<cfreturn q_NewsCategories>
</cffunction>

<!--- :::Function: Retrieve List of Parks --->
<cffunction name="getCategoriesTopics" access="remote"
returnType="query">
<cfargument name="NewsCategories" type="string">

<CFQUERY NAME="q_getCategoryName" Datasource="reboot">
SELECT ID, Category, CategoryName, ShortName, FeedURL FROM news
WHERE (Category = '#TRIM(NewsCategories)#')
ORDER BY Category
</CFQUERY>
<cfreturn q_getCategoryName>
</cffunction>

<!--- :::Function: Retrieve news Details --->
<cffunction name="getCategoryDetails" access="remote"
returnType="query">
<cfargument name="thisShortName" type="string">

<CFQUERY NAME="q_CategoryDetails" Datasource="reboot">
SELECT * FROM news
WHERE ShortName = '#thisShortName#'
</CFQUERY>
<cfreturn q_CategoryDetails>
</cffunction>

<!--- :::Function: Retrieve FeedURL news Details --->
<cffunction name="getFeedURL" access="remote" returnType="query">
<cfargument name="thisFeedURL" type="string">

<cfparam name="Form.Category" default="ALL">
<cfparam name="URL.Category" default="ALL">
<cfquery name="q_FeedURL" datasource="reboot">
SELECT *
FROM News
WHERE ShortName = '#ID#'
</cfquery>
<!--- // If there are no product records, display message and close
table. // --->

<cfset feed = "#q_FeedURL.FeedURL#">
<cftry>
<!--- use cfhttp to get the feed --->
<cfhttp url="#feed#" method="GET" resolveurl="false"></cfhttp>
<!--- use cfwddx to convert the feed results into a query. The query
name is defined in the "output" paramter in the tag below --->
<cfwddx action="WDDX2CFML" input="#CFHTTP.FileContent#"
output="newsfeed_data">
<!---
if no results were found or any other errors occur, make a fake query
-
this allows us to avoid having to do additional error handling when
the feed results are displayed.
--->
<cfcatch>
<CFSET newsfeed_data = QueryNew("headline_text, source,
harvest_time, URL")>
<!--- make a row in the query --->
<CFSET newRow = QueryAddRow(newsfeed_data, 1)>
<!--- set the cells in the query --->
<CFSET temp = QuerySetCell(newsfeed_data, "headline_text", "No News
Items Available",1)>
</cfcatch>
</cftry>


<cfparam name="maxrows" default="#newsfeed_data.recordcount#">

<cfoutput>#newsfeed_data.cluster#</cfoutput>
Current Stories
<cfoutput query="newsfeed_data" maxrows="#maxrows#">
<a href='#url#' target='_blank'>#headline_text#</a><a
href='#url#' target='_blank' class="leagal"></a><br>
(<strong>#source#</strong>) on #harvest_time#<br><br>

</cfoutput>


<cfreturn q_FeedURL>
</cffunction>
</cfcomponent>


I have uploaded the complete application source flash files with the database of all the Moreover news urls here.

http://www.yippykia.com/news.zip