I've set up a test just to see if I can make it work. I have a program
which needs to run some remote functions inside a perl script mostly
because there just isn't a better way to do it. I make a call to the
perl script using the httpservice and it all works fine except for the
return result. I know the perl script is executing because I have it
write the data to a file as well as try to write it back to the stream,
but no matter how I try to return it, I get an http request error. I've
tried setting the resultFormat to "object" and "printing" a string
variable which is composed of XML data from perl, but no luck. I also
tried printing the XML directly to the stream...no go. I've tried using
resultFormat="text" and "printing" the data from perl as html, but also
without success. Does anyone know how I can actually get a return from
the perl?
FWIW...the perl script is telneting to a router, pinging a private ip
address within the router, and returning the result. I know I could
re-write this in PHP, but my server is Windows and doesn't have php. All
the rest of my program and scripts are in .net.
code sample is below:
<script>...
//function to ping customer radios for diagnostics
private function ping_cust():void{
PingCustSvc.url = "http://www.myurl.com/pingcust.pl";
PingCustSvc.method = "POST";
var Obj:Object = new Object();
Obj.w = wispid;
Obj.cid = tgtdata;
Obj.rip = CustInfRouterIP.text;
Obj.cpeip = CustInfCpeIP.text;
PingCustSvc.send(Obj);
}
//handler for ping customer result
public function PingResult(event:ResultEvent):void{
response = event.result.pings.ping;
for (var i:int = 0; i < response.length; ++i) {
var resstr:String = resstr + response[i].result + "\n";
}
//var resstr:String = event.result.toString(); //attempt to
get data if it comes as string
Alert.show(resstr, "Ping Results");
}
//httpservice fault handler
public function handleFault(event:FaultEvent):void
{
var faultstr:String = event.fault.faultDetail;
Alert.show(event.fault.faultString, "Error");
}
...
</script>
<mx:HTTPService id="PingCustSvc" result="PingResult(event)"
fault="handleFault(event)" useProxy="false" method="POST"
resultFormat="object" />