Xinato,Here's a FlexViewer widget I wrote; it calls an elevation data SOE through REST and then handles the resulting JSON.http://www.arcgis.com/home/item.html?id=b9d247c297f144459854751740f59f68The SOE URL is here:http://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/WorldElevations/MapServer/exts/ElevationsSOE_NET/ElevationLayers/0/GetElevations
I use a Flex HTTPService object to make the call. I do it this way because I wrote the code a while ago. You might also use a BaseTask to do the same thing.Here's the MXML declaration:<s:HTTPService showBusyCursor="true" method="POST" id="websvcElevations" url="{_configXML.elevationSOEURL}" resultFormat="text"/>
And here's a bit of the code that makes the call and handles the response:var sGeoms:String = JSONUtil.encode( [ event.graphic.geometry ] );
var oParams:Object = {
"f" : "json",
"geometries" : sGeoms
}
// Send geometries off to SOE to get elevations
var atToken:AsyncToken = websvcElevations.send( oParams );
atToken.addResponder( new AsyncResponder(
//--- Handle results from elevation profile SOE ---//
function( event:ResultEvent, token:Object ):void {
try {
var oResult:Object = JSONUtil.decode( event.result.toString() );
if ( oResult.hasOwnProperty( "error" ) )
showError( "The server returned an error:\n" + oResult.error.message );
else { ... }
I hope that helps.