Just trying to figure out the proper syntax for making a POST to an HTTP Servlet from Flex. A Java developer gave me this URL to call:
http://myUrl:myPort/myProject/test/getFile/?fileId=1225
I want to build the the HTTPService url dynamically, meaning I pass the '1225' at the end.
My question is regarding how to translate that to MXML. Does that mean my HTTPService object looks like this?
<mx:HTTPService
id="rawFileServlet"
url="http://myUrl:myPort/myProject/test/getFile/?fileId="
method="POST"
showBusyCursor="true">
<mx:request xmlns="">
<fileId>
</fileId>
</mx:request>
</mx:HTTPService>
And my call is this:
params["fileId"] = 1225; httpServ.send(params);
Is that right? Something seems strange about it.
Here's updated code that works but doesn't allow me to trap remote errors nicely:
var url:String = model.fileUploadServletUrl;
var request:URLRequest = new URLRequest();
request.method = 'POST';
request.url = url;
var uvar:URLVariables = new URLVariables();
uvar.fileId = evt.fileId;
request.data = uvar;
try{
navigateToURL( request );
}
catch( e:Error ){
ErrorManager.processRemoteError( 'Download Excel failed' );
}