I am fit to be tied! I have been battling this HTTP Server Request error for hours. I have read through the blogs, boards, and other sites with great information, however, I still fail to get my app working. Uggh! The application continues to fail.
Environment:
1. Using an external server
2. Have complete control over server
3. Running Coldfusion 8
4. Using Flex Builder 3
5. SQL 2005
Situation:
I am trying to create a simple connection between my Flex application, Coldfusion, and SQL 2005. I am taking baby steps and using a pre-tested example using Friends of ED Foundation "Flex for Developers" book detailing the following code examples. My file DBtestCFM_app.html calls the swf file which calls the messageboard.cfm file and calls the crossdomain.xml file.
I have the crossdomain.xml file at the root of the mydomainname folder.
Flex MXML:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="messageRequest.send()">
<mx:HTTPService id="messageRequest" useProxy="false" method="POST" resultFormat="e4x" url="http://mydomainname.com/flex/DBtestCFM_app.html">
<mx:request xmlns="">
<emailaddress>{emailaddress.text}</emailaddress>
<message>{message.text}</message>
<messagetopic>{messagetopic.text}</messagetopic>
<postername>{postername.text}</postername>
</mx:request>
</mx:HTTPService>
<mx:StringValidator id="nameSV" source="{postername}"
property="text" trigger="{btnSubmit}" triggerEvent="click"/>
<mx:StringValidator id="emailSV" source="{emailaddress}"
property="text" trigger="{btnSubmit}" triggerEvent="click"/>
<mx:StringValidator id="topicSV" source="{messagetopic}"
property="text" trigger="{btnSubmit}" triggerEvent="click"/>
<mx:StringValidator id="messageSV" source="{message}"
property="text" trigger="{btnSubmit}" triggerEvent="click"/>
<mx:VBox x="10" y="10">
<mx:DataGrid id="dgMessage" x="25" y="200"
dataProvider="{messageRequest.lastResult.posting}">
<mx:columns>
<mx:DataGridColumn headerText="Poster Name"
dataField="postername" width="200"/>
<mx:DataGridColumn headerText="Email Address"
dataField="emailaddress" width="200"/>
<mx:DataGridColumn headerText="Message Topic"
dataField="messagetopic" width="200" />
</mx:columns>
</mx:DataGrid>
<mx:TextArea height="100" width="400"
text="{dgMessage.selectedItem.message}"/>
<mx:Form x="25" y="10" width="500">
<mx:FormItem label="Your Name:"
required="true">
<mx:TextInput id="postername" />
</mx:FormItem>
<mx:FormItem label="Email Address:"
required="true">
<mx:TextInput id="emailaddress" />
</mx:FormItem>
<mx:FormItem label="Message Topic:"
required="true">
<mx:TextInput id="messagetopic" />
</mx:FormItem>
<mx:FormItem label="Message"
required="true">
<mx:TextArea id="message" />
</mx:FormItem>
<mx:Button id="btnSubmit" label="Submit"
click="messageRequest.send()"/>
</mx:Form>
</mx:VBox>
</mx:Application>
Messageboard.cfm
<cfprocessingdirective suppresswhitespace="yes" pageencoding="utf-8">
<cfif isDefined("emailaddress") AND isDefined("message")
AND isDefined("messageTopic") AND isDefined("postername") AND
emailAddress NEQ "" AND message NEQ "" AND messageTopic NEQ ""
AND postername NEQ "">
<cfquery name="addInfo" datasource="#application.dsn.name#" username="#application.dsn.user#" password="#application.dsn.pwd#">
INSERT INTO messageData(emailaddress, message, messagetopic,
postername) VALUES("#emailaddress#"," #message#"," #messagetopic#"," #postername#")
</cfquery>
</cfif>
<cfquery name="allInfo" datasource="#application.dsn.name#" username="#application.dsn.user#" password="#application.dsn.pwd#">
SELECT ID, emailaddress, message, messagetopic, postername
FROM messageData
</cfquery>
<cfxml variable="messageXML">
<posters>
<cfloop query="allInfo">
<cfoutput>
<posting>
<id>#id#</id>
<emailaddress>#emailaddress#</emailaddress>
<message>#message#</message>
<messagetopic>#messagetopic#</messagetopic>
<postername>#postername#</postername>
</posting>
</cfoutput>
</cfloop>
</posters>
</cfxml>
<cfoutput>#messageXML#</cfoutput>
</cfprocessingdirective>
Crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM " http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" />
<allow-http-request-headers-from domain=”*” headers=”SOAPAction”/>
</cross-domain-policy>