We are constructing an app that talk directly to an unfederated Arcgis 10.61 enterprise server.
We are trying to upload data to a secure feature service but the applyEditsAsync is returning immediately and not uploading the data.
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">applyEdits</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">final</SPAN> ListenableFuture<SPAN class="operator token"><</SPAN>List<SPAN class="operator token"><</SPAN>FeatureEditResult<SPAN class="operator token">>></SPAN> editResult <SPAN class="operator token">=</SPAN> _fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">applyEditsAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// THE PROBLEM: request does not reach the server</SPAN>
editResult<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addDoneListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// RETURNS IMMEDIATELY</SPAN>
<SPAN class="keyword token">try</SPAN> <SPAN class="punctuation token">{</SPAN>
List<SPAN class="operator token"><</SPAN>FeatureEditResult<SPAN class="operator token">></SPAN> editResults <SPAN class="operator token">=</SPAN> editResult<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// editResults IS EMPTY</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>editResults <SPAN class="operator token">!=</SPAN> null <SPAN class="operator token">&&</SPAN> <SPAN class="operator token">!</SPAN>editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">isEmpty</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
FeatureEditResult result <SPAN class="operator token">=</SPAN> editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>result<SPAN class="punctuation token">.</SPAN><SPAN class="token function">hasCompletedWithErrors</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">throw</SPAN> editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">getError</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">InterruptedException</SPAN> <SPAN class="operator token">|</SPAN> ExecutionException e<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">runOnUiThread</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> <SPAN class="token function">logToUser</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">true</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token function">getString</SPAN><SPAN class="punctuation token">(</SPAN>R<SPAN class="punctuation token">.</SPAN>string<SPAN class="punctuation token">.</SPAN>error_applying_edits<SPAN class="punctuation token">,</SPAN> e<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getCause</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">getMessage</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>the GIS Server log contains the following:
FINE 25 Sep 2019 13:51:09 REST request successfully processed. Response size is 306601 characters. GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:09 REST request successfully processed. Response size is 274509 characters. GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:08 REST request received. Request size is 30 characters. GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:08 REST request received. Request size is 30 characters. GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:08 GraphicFeatureServer::HandleRESTRequest ## requestProperties = {"computeETag":true,"Aggregate":false} GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:08 GraphicFeatureServer::HandleRESTRequest ## inputJSON = {"returnAdvancedSymbols":true} GRIN/GRIN_secure.MapServer
FINE 25 Sep 2019 13:51:08 Wait time for 'GRIN.GRIN_secure.MapServer' service request is 0 milliseconds. Server
INFO 25 Sep 2019 13:51:08 Request user: test, Service: GRIN/GRIN_secure/FeatureServer Rest
FINE 25 Sep 2019 13:51:05 HTTP Referer: Not Available Server
INFO 25 Sep 2019 13:51:05 Request user: Anonymous user, Service: GRIN/GRIN_secure/FeatureServer Rest
I am thinking the issue may be authentication related as the log is not showing a token being passed in the request
FINE 25 Sep 2019 13:51:08 GraphicFeatureServer::HandleRESTRequest ## inputJSON = {"returnAdvancedSymbols":true} GRIN/GRIN_secure.MapServer
(log entry from 10.2.9)
FINE Sep 25, 2019, 12:41:56 PM GraphicFeatureServer::HandleRESTRequest ## inputJSON = {"returnAdvancedSymbols":false,"token":"ag6BjT8jWJKv5BzLaQO5_Hd4zGrhfqyun3PDduWM6qZet73sZ0olSPYbM_3B2b5B"} GRIN/GRIN_secure.MapServer
but the server is still responding with the metadata
FINE 25 Sep 2019 13:51:09 REST request successfully processed. Response size is 274509 characters. GRIN/GRIN_secure.MapServer
Main call:
<SPAN class="keyword token">private</SPAN> ServiceFeatureTable _fl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">loadService</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">final</SPAN> <SPAN class="keyword token">int</SPAN> layerId<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
String url <SPAN class="operator token">=</SPAN> _url <SPAN class="operator token">+</SPAN> String<SPAN class="punctuation token">.</SPAN><SPAN class="token function">valueOf</SPAN><SPAN class="punctuation token">(</SPAN>layerId<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
AuthenticationChallengeHandler ah <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">AuthenticationChallengeHandler</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
@Override
<SPAN class="keyword token">public</SPAN> AuthenticationChallengeResponse <SPAN class="token function">handleChallenge</SPAN><SPAN class="punctuation token">(</SPAN>AuthenticationChallenge authenticationChallenge<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
String message <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Authentication Failed! "</SPAN><SPAN class="punctuation token">;</SPAN>
message <SPAN class="operator token">+=</SPAN> authenticationChallenge<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getException</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">getMessage</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="token function">fireProgressEvent</SPAN><SPAN class="punctuation token">(</SPAN>SYNC_ERROR<SPAN class="punctuation token">,</SPAN> message<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> null<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
AuthenticationManager<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setAuthenticationChallengeHandler</SPAN><SPAN class="punctuation token">(</SPAN>ah<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_fl <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ServiceFeatureTable</SPAN><SPAN class="punctuation token">(</SPAN>url<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setFeatureRequestMode</SPAN><SPAN class="punctuation token">(</SPAN>ServiceFeatureTable<SPAN class="punctuation token">.</SPAN>FeatureRequestMode<SPAN class="punctuation token">.</SPAN>ON_INTERACTION_CACHE<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setCredential</SPAN><SPAN class="punctuation token">(</SPAN>_cred<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">loadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addDoneLoadingListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>_fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getLoadStatus</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">equals</SPAN><SPAN class="punctuation token">(</SPAN>LoadStatus<SPAN class="punctuation token">.</SPAN>LOADED<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">uploadObservation</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//creates the feature and calls applyEdits()</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Is this correct behaviour for 100.6 or am I correct and it's an issue with authentication