HI, I am trying to run a very simple python tool as Geo-processing Service. As usual I created the tool as follows:
<SPAN class="keyword token">import</SPAN> arcpy
inputLong <SPAN class="operator token">=</SPAN> float<SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
inputLat <SPAN class="operator token">=</SPAN> float<SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
xy <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">(</SPAN>inputLat<SPAN class="punctuation token">,</SPAN> inputLong<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
fc <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"Database Connections\Connection to xyz-xyz.sde\A.DBO.CropPoint"</SPAN>
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"SHAPE@XY"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> xy<SPAN class="punctuation token">:</SPAN>
cursor<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>row<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> cursor<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
and shared as Geo-processing Service on my ArcGIS server. On JavaScript I wrote the code as follows:
<SPAN class="keyword token">var</SPAN> gpUrl <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2FXXX-xyz%3A6080%2Farcgis%2Frest%2Fservices%2FScript2%2FGPServer" target="_blank">http://xyz-xyz:6080/arcgis/rest/services/Script2/GPServer</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> gp <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Geoprocessor</SPAN><SPAN class="punctuation token">(</SPAN>gpUrl<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> params1 <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN>
Longitude<SPAN class="punctuation token">:</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">101.55</SPAN><SPAN class="punctuation token">,</SPAN>
Latitude<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">35.6</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
gp<SPAN class="punctuation token">.</SPAN><SPAN class="token function">submitJob</SPAN><SPAN class="punctuation token">(</SPAN>params1<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>It does not work (i.e. does not add point to my point map), however I can directly run it in the "ArcGIS REST Services Directory" on my browser. Also I tried "gp.execute(params1)" to run the tool.