How to register a runtime geodatabase with a feature service?

2388
3
07-13-2016 05:29 PM
by Anonymous User
Not applicable

Hi - am hoping someone can shed some light on how this workflow can be made to work...

Ideally, I want to be able to generate an offline runtime geodatabase (either through arcmap or via an app), then take that file and distribute across many different users, allowing them to then continue editing and synchonizing two way. The documentation says ‘You must unregister the geodatabase to share it.’

I generated a geodatabase with an app, then tested the geodatabasesynctask.unregisterGeodatabase method and I can see via the rest services that it has removed the corresponding replica in that feature service. The documentation suggests that you can call registerGeodatabase to register it and sync it again.

I try that, and get an error message:  Unable to complete operation. Code= 404 Replica with GUID ({08A584D7-A88D-468B-ADA6-045B7809D7A8}) does not exists on the server.

I think I’m missing something in the workflow here?

https://developers.arcgis.com/qt/qml/api-reference/class_geodatabase_sync_task.html

GeodatabaseSyncTask::unregisterGeodatabase

(

Geodatabase

geodatabase

)

Unregisters the local geodatabase from the service.

You must unregister the geodatabase to share it. Re-register the unregistered geodatabase before using it again by calling registerGeodatabase().

When the geodatabase is unregistered from the service, any local edits are lost and no further syncs can be made until the geodatabase is registered.

GeodatabaseSyncTask::registerGeodatabase

(

Geodatabase

geodatabase

)

Registers the local geodatabase with the service.

This method registers a geodatabase so that it can be used to sync edits with an ArcGIS service. The property Geodatabase.isSyncEnabled must be true for successful registration.

This method emits the geodatabaseStatusChanged() signal. Use the GeodatabaseSyncStatusInfo with GeodatabaseSyncStatusInfo.status property to determine when the geodatabase registration completes.

0 Kudos
3 Replies
nakulmanocha
Esri Regular Contributor

HI Paul,

If you getting this error "Unable to complete operation. Code= 404 Replica with GUID ({08A584D7-A88D-468B-ADA6-045B7809D7A8}) does not exists on the server." This means that replica you are trying to register is not created from that feature service. Or something got changed with the feature service from the point when the replica was created.

-Nakul

by Anonymous User
Not applicable

Hi Nakul

Have just testing again now, and can confirm that the register method does not work as the documentation suggests. I think the issue is with the documentation, probably not the actual methods.

I generated an offline geodatabase, unregistered it, then attempted to register it straight away and got the same error message about replica with guid not existing on the server.

Looking at the Fiddler logs, the unregister method is a straight rest api call to the unregister replica url. This I think is an irreversible action and the replica can never be registered again.

When it attempts to 'register' the replica, it send the following parameters (from Fiddler logs), and you can see it is trying to register existing data, but in the last parameter it is referencing the old replica id.

{"registerExistingData":{"refLayerServerGens":[{"clientGen":0,"id":0,"serverGen":1468894759317,"syncDirection":"bidirectional"},{"clientGen":0,"id":1,"serverGen":1468894705783,"syncDirection":"bidirectional"},{"clientGen":0,"id":2,"serverGen":1468894705783,"syncDirection":"bidirectional"},{"clientGen":0,"id":3,"serverGen":1468894705783,"syncDirection":"bidirectional"},{"clientGen":0,"id":4,"serverGen":1468894705783,"syncDirection":"bidirectional"},{"clientGen":0,"id":5,"serverGen":1468894705783,"syncDirection":"bidirectional"}],"refReplicaId":"{9C282D10-7D0D-4E93-8A9C-15A27A7B0ED3}"}}

However, I tried the following and it worked:

  • Create an offline geodatabase as one user. (Did *not* unregister it).
  • Log in as a different user, confirm that a sync correctly fails because it is the wrong user.
  • Call the 'register' method, which appears to clone the existing replica to a new one for this user.
  • Was able to sync using the new user.

Cheers,

-Paul

0 Kudos
nakulmanocha
Esri Regular Contributor

Hi Paul,

That is true- Please remember these couple of things when distributing the replicas for offline editing and sycning

  • Once you call unregister on a geodatabase, you cannot re-register the same geodatabase.
  • If the original geodatabase is ever unregistered, no additional clients can use that copy to register.

I hope this helps.

Nakul

0 Kudos