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.
private void applyEdits() {
final ListenableFuture<List<FeatureEditResult>> editResult = _fl.applyEditsAsync(); // THE PROBLEM: request does not reach the server
editResult.addDoneListener(() -> { // RETURNS IMMEDIATELY
try {
List<FeatureEditResult> editResults = editResult.get(); // editResults IS EMPTY
if (editResults != null && !editResults.isEmpty()) {
FeatureEditResult result = editResults.get(0);
if (!result.hasCompletedWithErrors()) {
...
}
} else {
throw editResults.get(0).getError();
}
}
} catch (InterruptedException | ExecutionException e) {
runOnUiThread(() -> logToUser(true, getString(R.string.error_applying_edits, e.getCause().getMessage())));
}
});
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:
private ServiceFeatureTable _fl;
private void loadService(final int layerId) {
String url = _url + String.valueOf(layerId);
AuthenticationChallengeHandler ah = new AuthenticationChallengeHandler() {
@Override
public AuthenticationChallengeResponse handleChallenge(AuthenticationChallenge authenticationChallenge) {
String message = "Authentication Failed! ";
message += authenticationChallenge.getException().getMessage();
fireProgressEvent(SYNC_ERROR, message);
return null;
}
};
AuthenticationManager.setAuthenticationChallengeHandler(ah);
_fl = new ServiceFeatureTable(url);
_fl.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE);
_fl.setCredential(_cred);
_fl.loadAsync();
_fl.addDoneLoadingListener(() -> {
if (_fl.getLoadStatus().equals(LoadStatus.LOADED)) {
uploadObservation();
//creates the feature and calls applyEdits()
}
});
}
Is this correct behaviour for 100.6 or am I correct and it's an issue with authentication
Followed up with some more testing by sending a query instead of an edit. This passed successfully and returned the correct query result, so my idea about authentication was wrong leading me to change my original appraisal to a possible licencing issue. The feature we are using requires a basic licence to function and we are using our developer licence to test with. According to documentation this should work but will return a watermark on any produced maps (which we are not returning to.
I am wondering if it is failing because we are sending data directly to the ArcGIS Server rather than via a portal rest interface.
Ok, we fixed the issue ourselves. Just in case anybody else has a similar issue it was being caused by generic type mapping on the feature. To fix it we had to cast each attribute to it's esri field type in our feature class.
In the prior version (10.2.9) the runtime could successfully map generic types to their relevant esri types but it seems that the new sdk cannot do that without generating an exception on incompatible data types. I am unsure if this is by design or if it is a bug, maybe an esri guru could tell us.
Hi Rob,
Please could you send us a code snippet regarding: "To fix it we had to cast each attribute to it's esri field type in our feature class"? Could you send us the code for what you have done before your fix and what you have done to get it fixed?
Thanks, Gunther