Hi folks. I am a pretty experienced database programmer, I
work with a software called Magic eDev, but I'm a newby in Flex.
I am trying to use Flex 3 to create a web / client interface
for an application written in Magic eDev. I am still trying to get
my head around Flex, (Magic is a completely different programming
paradigm) and I've made a very simple Flex App to read an XML file
generated by another application written in a third party software
(Magic eDev 9.4) via HTTPService. I think I have the HTTPService
request part figured out, This little Application does not cause
any errors. However, I am not seeing my data in the display. If I
manually try the URL query to the Magic App, I do get the XML file
with the data in it, but Flex doesn't seem to see anything.
I just want to get two fields via the HTTPService data and
display them, but I'm not getting any result. I can't even tell if
Flex is actually querying Magic or not. Can anyone explain what I'm
doing wrong?
Also, is there some way to monitor what the Flex app is doing
when you run it, as you can in some other systems?
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function serv_result(evt:ResultEvent):void {
var resultObj:Object = evt.result;
userName.text = resultObj.catalog.username;
emailAddress.text = resultObj.catalog.emailaddress;
}
private function serv_fault(evt:FaultEvent):void {
error.text += evt.fault.faultString;
error.visible = true;
form.visible = false;
}
]]>
</mx:Script>
<mx:String id="XML_URL">album.xml</mx:String>
<mx:HTTPService id="loginService"
url="
http://localhost/magic94scripts/mgrqcgi94.exe" method="POST"
result="{ResultEvent(event)}"
fault="{FaultEvent(event)}">
<mx:request>
<appname>FlexDispatch</appname>
<prgname>Test</prgname>
<arguments>username,emailaddres</arguments>
</mx:request>
</mx:HTTPService>
<mx:ApplicationControlBar dock="true">
<mx:Label text="{XML_URL}" />
</mx:ApplicationControlBar>
<mx:Label id="error"
color="red"
fontSize="36"
fontWeight="bold"
visible="false"
includeInLayout="{error.visible}"/>
<mx:Form id="form"
includeInLayout="{form.visible}">
<mx:FormItem label="resultObj.catalog.username:">
<mx:Label id="userName" />
</mx:FormItem>
<mx:FormItem label="resultObj.catalog.emailaddress:">
<mx:Label id="emailAddress" />
</mx:FormItem>
</mx:Form>
</mx:Application>
This is what the XML file looks like:
<?xml version="1.0" ?>
- <catalog>
<username>DaveID</username>
<emailaddress>DaveName</emailaddress>
</catalog>