Title:
Bug 78712:Event argument keys for a DataServicesMessaging gateway's onIncomingMessage function are now case sensitive
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Nathan Mische / Nathan Mische (Nathan Mische)
Created: 07/13/2009
Components: Event Gateway
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 9,0,0,241018 / 245884
Priority/Frequency: Major / Unknown
Locale/System: English / Platforms All
Vote Count: 2
Problem:
Event argument keys for a DataServicesMessaging gateway's onIncomingMessage function are now case sensitive. This is a change from ColdFusion 8.The following simple DataServicesMessaging gateway worked in CF 8:
<cfcomponent>
<cffunction name="onIncomingMessage" retruntype="any">
<cfargument name="event" type="struct" required="true">
<cfdump var="#event#" output="C:\event.txt">
<cfset msg = StructNew() />
<cfset msg.destination = "ColdFusionGateway">
<cfset msg.body["msg"] = event.data.body.msg />
<cfset msg.headers["username"] = event.data.headers.username />
<cfreturn msg/>
</cffunction>
</cfcomponent>
<!---
In CF 9 the above has to be modified to:
<cfcomponent>
<cffunction name="onIncomingMessage" retruntype="any">
<cfargument name="event" type="struct" required="true">
<cfset msg = StructNew() />
<cfset msg.destination = "ColdFusionGateway">
<cfset msg.body["msg"] = event["DATA"]["body"]["msg"] />
<cfset msg.headers["username"] = event["DATA"]["headers"]["username"] />
<cfreturn msg/>
</cffunction>
</cfcomponent>
--->
Method:
Attempt to access event argument keys using standard dot notation. Below are simple Flex client and gateway that demonstrate the error.Simple Flex Chat Client:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.messaging.events.*;
import mx.messaging.messages.*;
private var username:String;
private function messageHandler(e:MessageEvent):void
{
txtChat.text += e.message.headers.username + ": " + e.message.body.msg + "\n";
}
private function faultHandler(e:MessageFaultEvent):void
{
mx.controls.Alert.show(e.faultString + '\n' + e.faultDetail);
}
private function sendMessage():void
{
var msg:AsyncMessage = new AsyncMessage();
msg.body.msg = txtInput.text;
msg.headers.username = username;
msg.headers.gatewayid = "ChatMessagingGateway";
chatProducer.send(msg);txtInput.text = "";
}
private function sendStatusMessage(statusMsg:String):void
{
var msg:AsyncMessage = new AsyncMessage();
msg.body.msg = statusMsg;
msg.headers.username = username;
msg.headers.gatewayid = "ChatMessagingGateway";
chatProducer.send(msg);
}
private function logIn():void
{
username = txtUsername.text;
chatConsumer.subscribe();
sendStatusMessage("Logged In");
vsMain.selectedChild = chatForm;
}
private function logOut():void
{
sendStatusMessage("Logged Out");
chatConsumer.unsubscribe();
username = "";
txtChat.text = "";
vsMain.selectedChild = loginForm;
}
]]>
</mx:Script>
<mx:ChannelSet id="myChannelSet" >
<mx:channels>
<mx:AMFChannel url="http://localhost:8501/flex2gateway/cfamfpolling" id="cfAMFPolling" pollingEnabled="true" pollingInterval="8" />
</mx:channels>
</mx:ChannelSet>
<mx:Consumer channelSet="{myChannelSet}" id="chatConsumer" destination="ColdFusionGateway" message="messageHandler(event)" fault="faultHandler(event)"/>
<mx:Producer channelSet="{myChannelSet}" id="chatProducer" destination="ColdFusionGateway" fault="faultHandler(event)" />
<mx:ViewStack id="vsMain" height="100%" width="100%">
<mx:Canvas id="loginForm">
<mx:Panel x="10" y="10" width="250" height="200" layout="absolute" title="Chat Login">
<mx:TextInput id="txtUsername" x="10" y="36" width="210"/>
<mx:Button label="Log In" id="btnLogin" click="logIn()" x="10" y="66"/>
<mx:Label x="10" y="10" text="Username:"/>
<mx:ControlBar>
<mx:Label text="Connected: {chatConsumer.connected} | Subscribed: {chatConsumer.subscribed}"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
<mx:Canvas id="chatForm">
<mx:Panel x="10" y="10" width="250" height="439" layout="absolute" title="Chat">
<mx:TextInput id="txtInput" enter="sendMessage()" x="10" y="266" width="210"/>
<mx:TextArea height="250" id="txtChat" x="10" y="8" width="210"/>
<mx:Button label="Submit" id="btnSubmit" click="sendMessage()" x="10" y="296"/>
<mx:Button label="Log Out" id="btnLogout" click="logOut()" x="10" y="326"/>
<mx:ControlBar>
<mx:Label text="Connected: {chatConsumer.connected} | Subscribed: {chatConsumer.subscribed}"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
</mx:ViewStack>
</mx:Application>
DataServicesMessaging gateway, configured with GatewayID of ChatMessagingGateway in ColdFusion administrator:
<cfcomponent>
<cffunction name="onIncomingMessage" retruntype="any">
<cfargument name="event" type="struct" required="true">
<cfdump var="#event#" output="C:\event.txt">
<cfset msg = StructNew() />
<cfset msg.destination = "ColdFusionGateway">
<cfset msg.body["msg"] = event.data.body.msg />
<cfset msg.headers["username"] = event.data.headers.username />
<cfreturn msg/>
</cffunction>
</cfcomponent>
Result:
Element DATA.BODY.MSG is undefined in EVENT.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3039239
External Customer Info:
External Company:
External Customer Name: Nathan Mische
External Customer Email: 8183044544637AAA99201549
External Test Config: 07/13/2009
Attachments:
Comments: