I've been looking at sending and receiving data asyncronously using Flex's HTTPService and native Flash data loading capabilities.
One thing that tripped me up with that xml.load() was an asyscronous data call -- which means you cannot use the result/return object until it is completly loaded. One way around this is to use the AS delegate to invoke a function which uses the result. Below is some code.
http://www.macromedia.com/2003/mxml">
function LoadRequest() {
var myXML = new XML();
myXML.ignoreWhite = true;
myXML.load ("tree.xml");
myXML.onLoad = mx.utils.Delegate.create(this, function() { myService.send(myXML) });
}
function ProcResult(event) {
txtDebug.text = event.result;
}
function ProcFault(errorString, code) {
txtIssuerList.text = errorString + " " + code ;
}
http://localhost:8700/flex/servlet/test.MyServletPrintln" contentType="application/xml" method="post" id="myService"
fault="ProcFault(event.fault.faultstring, event.fault.faultcode)" result="ProcResult(event)">