Original User: zanadyHi everyone,I am trying to develop a intersection widget using the geoprocessing service. my geoprocessing service is as follows:[ATTACH=CONFIG]32889[/ATTACH][ATTACH=CONFIG]32890[/ATTACH] I try to consomer this service in my flex application this is my code: <?xml version="1.0" encoding="utf-8"?>
<!--
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010-2011 Esri. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:viewer="com.esri.viewer.*"
xmlns:components="com.esri.viewer.components.*"
creationComplete="init()">
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import mx.rpc.events.FaultEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.managers.CursorManager;
import com.esri.ags.layers.GraphicsLayer;
import mx.rpc.AsyncResponder;
import com.esri.ags.tasks.supportClasses.ExecuteResult;
import com.esri.ags.tasks.supportClasses.ParameterValue;
private var intersectLyrLen:int;
private var msgVisible:Boolean = false;
public var graphiclayer:GraphicsLayer=new GraphicsLayer();
private function init():void
{
graphiclayer=new GraphicsLayer();
graphiclayer.symbol= intersectSimpleFill;
map.addLayer(graphiclayer);
}
private function intersectIfOptionsValid():void
{
var hasAreaSelected:Boolean = (map.defaultGraphicsLayer.numGraphics > 0);
var hasSelectedLayersTointersect:Boolean = pointsCheckBox.selected || lignesCheckBox.selected || Mar_adm1CheckBox.selected ||Mar_adm2CheckBox.selected ||Mar_adm3CheckBox.selected ||Mar_adm4CheckBox.selected ;
if (hasAreaSelected && hasSelectedLayersTointersect)
{
intersectdata();
}
else
{
showErrorMessage("Select layers to intersect");
}
}
private function showErrorMessage(content:String):void
{
Alert.show(content, "Geoprocessing Task Error");
}
private function intersectdata():void
{
var requestObject:Object = createRequestObject();
gp.execute(requestObject,new AsyncResponder(onResult, onFault));
function onResult(gpResultat:ExecuteResult=null,token:Object=null):void
{
var pv:ParameterValue = gpResultat.results[0];
var fs:FeatureSet = pv.value as FeatureSet;
graphiclayer.graphicProvider=fs.features;
intersectLyrLen = graphiclayer.numGraphics;
msgVisible = true;
}
function onFault(info:Object,token:Object=null):void
{
Alert.show(info.toString());
graphiclayer.clear();
}
}
private function createRequestObject():Object
{
var layers1Tointersect:Array = getLayers1tointersect();
var layers2Tointersect:Array=getLayers2tointersect();
var requestObject:Object = {
"points ": layers1Tointersect,
"Mar_adm4": layers2Tointersect
};
return requestObject;
}
private function getLayers1tointersect():Array
{
var layers1Tointersect:Array = [];
if (pointsCheckBox.selected)
{
layers1Tointersect.push(pointsCheckBox.label);
}
if (lignesCheckBox.selected)
{
layers1Tointersect.push(lignesCheckBox.label);
}
if (Mar_adm1CheckBox.selected)
{
layers1Tointersect.push(Mar_adm1CheckBox.label);
}
if (Mar_adm2CheckBox.selected)
{
layers1Tointersect.push(Mar_adm2CheckBox.label);
}
if (Mar_adm3CheckBox.selected)
{
layers1Tointersect.push(Mar_adm3CheckBox.label);
}
if (Mar_adm4CheckBox.selected)
{
layers1Tointersect.push(Mar_adm4CheckBox.label);
}
return layers1Tointersect;
}
private function getLayers2tointersect():Array
{
var layers2Tointersect:Array = [];
if (pointsCheckBox.selected)
{
layers2Tointersect.push(pointsCheckBox.label);
}
if (lignesCheckBox.selected)
{
layers2Tointersect.push(lignesCheckBox.label);
}
if (Mar_adm1CheckBox.selected)
{
layers2Tointersect.push(Mar_adm1CheckBox.label);
}
if (Mar_adm2CheckBox.selected)
{
layers2Tointersect.push(Mar_adm2CheckBox.label);
}
if (Mar_adm3CheckBox.selected)
{
layers2Tointersect.push(Mar_adm3CheckBox.label);
}
if (Mar_adm4CheckBox.selected)
{
layers2Tointersect.push(Mar_adm4CheckBox.label);
}
return layers2Tointersect;
}
private function clearintersect():void
{
intersectLyrLen = 0;
graphiclayer.clear();
}
]]>
</fx:Script>
<fx:Declarations>
<esri:SimpleFillSymbol id="intersectSimpleFill"
alpha="0.5"
color="0xFF0000">
<esri:SimpleLineSymbol width="1"
alpha="0.5"
color="0x000000"/>
</esri:SimpleFillSymbol>
<esri:Geoprocessor id="gp"
outSpatialReference="{map.spatialReference}"
url="http://localhost:6080/arcgis/rest/services/Geotraitement/intersection/GPServer/intersect"
useAMF="false"/>
</fx:Declarations>
<viewer:WidgetTemplate id="helloWorld"
width="300" height="300">
<s:Label x="26" y="23" text="Intersection entre deux couches :"/>
<s:CheckBox id="pointsCheckBox" x="62" y="57" label="points"/>
<s:CheckBox id="lignesCheckBox" x="62" y="83" label="lignes"/>
<s:CheckBox id="Mar_adm1CheckBox" x="62" y="109" label="Mar_adm1"/>
<s:CheckBox id="Mar_adm2CheckBox" x="62" y="135" label="Mar_adm2"/>
<s:CheckBox id="Mar_adm3CheckBox" x="62" y="161" label="Mar_adm3"/>
<s:CheckBox id="Mar_adm4CheckBox" x="62" y="187" label="Mar_adm4"/>
<s:Button x="115" y="233" label="executer" click="intersectdata()"/>
<s:Button x="202" y="264" label="clear" click="clearintersect()"/>
</viewer:WidgetTemplate>
</viewer:BaseWidget>
When I execute the widget an error message appears:"[RPC Fault faultString="Unable to complete operation." faultCode="400" faultDetail="Erreur d�??exécution de l�??outil."]" I am beginner can i guide me?