Select to view content in your preferred language

error  call the GP Server  in flex 4.6

2675
4
09-07-2012 07:22 AM
yanli
by
Emerging Contributor
<fx:Declarations>
<esri:Geoprocessor  executeComplete="gp_jobCompleteHandler(event)"  useAMF="false"  showBusyCursor="true"     id="gp"        url="http://yanli/arcgis/rest/services/gp1/GPServer/polygon"/>

</fx:Declarations>
gp.execute(param);  //  error  here!!!



when  i  chang the  code  with  setting  "URL" null  ??the  error  is  same .... but  the param  have  the  value,the GP server run  well  in the ArcMAP

<fx:Declarations>
<esri:Geoprocessor  executeComplete="gp_jobCompleteHandler(event)"  useAMF="false"  showBusyCursor="true"     id="gp"        url=""/>

</fx:Declarations>
gp.execute(param);  //  error  here!!!




I  am  carazing    !!!!!!!!!!!!!!!now

the error  message  as following:

TypeError: Error #1009:Can not access a property or method of a null object reference???
at com.esri.ags.utils::GeometryUtil$/http://www.esri.com/2008/ags/internal::normalizeCentralMeridian2()
at com.esri.ags.utils::GeometryUtil$/normalizeCentralMeridian()
at com.esri.ags.tasks::Geoprocessor/toURLVariables()
at com.esri.ags.tasks::Geoprocessor/execute()
at test2/onQueryResult()
at mx.rpc::AsyncResponder/result()
at com.esri.ags.tasks::QueryTask/handleExecute()
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/loaderCompleteHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Tags (2)
0 Kudos
4 Replies
DasaPaddock
Esri Regular Contributor
What version of the API are you using?

What is your param?

Can you share a complete test?
0 Kudos
yanli
by
Emerging Contributor
My arcgis  Api for  flex  vesion  is  :2.5
arcigs server version  is :10
flash builder version :4.6


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:esri="http://www.esri.com/2008/ags"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 <fx:Declarations>
  <esri:Geoprocessor  executeComplete="gp_jobCompleteHandler(event)"   showBusyCursor="true"     id="gp"        url="http://yanli/arcgis/rest/services/gp1/GPServer/polygon"/>

 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   
   import com.esri.ags.FeatureSet;
   import com.esri.ags.events.GeoprocessorEvent;
   import com.esri.ags.layers.GPResultImageLayer;
   import com.esri.ags.layers.supportClasses.ImageParameters;
   import com.esri.ags.tasks.QueryTask;
   import com.esri.ags.tasks.supportClasses.Query;
   import com.esri.ags.tasks.supportClasses.JobInfo;
   
   import mx.controls.Alert;
   import mx.rpc.AsyncResponder;
   import mx.rpc.events.FaultEvent;
   
   
   private var  jobid:String="";
   
   private function gp_jobCompleteHandler(event:GeoprocessorEvent):void
   {
    if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED)
    {
     Alert.show("sueeseful!")
    }
    else
    {
     
    }
   }
   
   private function computesevice():void
   {
    
    var queryTask:QueryTask =new QueryTask("http://localhost/arcgis/rest/services/test/MapServer/0");
    queryTask.showBusyCursor=true;
    var query:Query=new Query();
    query.outFields=new Array("OBJECTID","yuliang","name")
    query.where="name<>''"
    
    queryTask.execute(query,new AsyncResponder(onQueryResult,onQueryFalt));
    
    function  onQueryFalt(info:Object,token:Object=null):void
    {
     
     Alert.show(info.toString());
    }
    
    
    
   }
   private function onQueryResult(featureset:FeatureSet,token:Object=null):void
   {
    
    var param:Object={"inputpoint":featureset};;
    gp.execute(param);
    
   }
   
  ]]>
 </fx:Script>
 <s:Button label="�?�?�GP" click="computesevice()"/>
 <esri:Map y="30" id="myMap" width="100%"  height="100%" >        
  <!--       <esri:extent>            
  <esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">                
  <esri:SpatialReference wkid="4326"/>            
  </esri:Extent>        
  </esri:extent>-->
  <esri:ArcGISDynamicMapServiceLayer      url="http://localhost/arcgis/rest/services/test/MapServer"/>    
  <esri:GraphicsLayer id="graphicsLayer"  />
 </esri:Map> 
</s:Application>

0 Kudos
DasaPaddock
Esri Regular Contributor
0 Kudos
by Anonymous User
Not applicable
Other troubleshooting steps would be to test your GP service using its REST page. If the service gives you the expected results back, it should work in your flex code.  Other things to check would be what gets sent in the http request. You can use firebug here to help. Copy the FeatureSet JSON representation and then test it using your REST page.  Also make sure your GP service is synchronous, as I see you are using execute vs submitJob.
0 Kudos