+ Reply to Thread
Results 1 to 3 of 3

Thread: Getting "Invalid file or corrupted file" Exception when Opening Map Cache after Sync

  1. #1
    Kevin Bupp
    Join Date
    May 2010
    Posts
    14
    Points
    10
    Answers Provided
    2


    0

    Default Getting "Invalid file or corrupted file" Exception when Opening Map Cache after Sync

    Ok, So I have this Windows Mobile 6 ArcGIS Mobile 10 SDK application that I can get to run wonderfully as long as I have created a mobile cache and physically placed it onto the device.

    But whenever I try to use a MobileServiceConnection, MobileCache, and MobileCacheSyncAgent to Synchronize my map with the MapServer on my ArcGIS Server I get a "Invalid file or corrupted file" exception as soon as I try to open the MobileCache.

    I checked the ArcGIS Server logs and it appears to be receiving the request, and processing it correctly:
    Code:
    Level	Message									Time			Configuration
    INFO3	Server Context released.						2012-03-23 17:40:37	Facilities.MapServer	
    INFO2	Binary request successfully processed. Response size is 2136 bytes.	2012-03-23 17:40:37	Facilities.MapServer	
    DEBUG	MobileSync: Get Schema [elapsed time = 0.001189 seconds].		2012-03-23 17:40:37	Facilities.MapServer	
    DEBUG	Schema Checksum 2197403820.						2012-03-23 17:40:37	Facilities.MapServer	
    INFO2	Binary request received. Request size is 5 bytes.			2012-03-23 17:40:37	Facilities.MapServer	
    INFO3	Server Context created.							2012-03-23 17:40:37	Facilities.MapServer
    Here is my
    Code:
                try
                {
                    if (!Utility.CheckURLConnection(AppProps.MobileMapServiceURL + "?wsdl"))
                    {
                        MessageBox.Show("Not able to connect to map server.");
                    }
                    mobileMapServiceCache.StoragePath = mobileMapServiceCachePath;
                    mobileMapServiceCache.DeleteCache();
                    mobileMapServiceConn.Url = AppProps.MobileMapServiceURL;
                    MobileCacheSyncAgent mobileSync = new MobileCacheSyncAgent(mobileMapServiceCache, mobileMapServiceConn);
                    if (mobileSync.IsValid)
                    {
                        mobileMapServiceConn.CreateCache(mobileMapServiceCache);
                        //mobileSync.StateChanged += new EventHandler(mobileSync_StateChanged);
                        //mobileSync.ProgressChanged += new EventHandler<MobileCacheSyncAgentProgressEventArgs>(mobileSync_ProgressChanged);
                        SyncResults mobileResults = mobileSync.Synchronize();
                        MessageBox.Show(mobileResults.DataSizeReceived.ToString());
                        mobileMapServiceCache.Open();
                        map1.DataSources.Add(mobileMapServiceCache);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Cannot synchronize with the mobile map service: " + ex.Message);
                }
    I even tried adding event handlers to the MobileCacheSyncAgent ... but they were never called ...

    The MessageBox right before the mobileMapServiceCache.Open(); call always return 0 ...

    back in 9.3.1 all we had to do was use a MobileService ... am I doing something wrong? Please help!

    Thanks!!

  2. #2
    Kevin Bupp
    Join Date
    May 2010
    Posts
    14
    Points
    10
    Answers Provided
    2


    0

    Arrow Re: Getting "Invalid file or corrupted file" Exception when Opening Map Cache after S

    Furthermore, I have tried the following with no success
    • downloading and installing the latest build of ArcGIS Mobile (build 2550)
    • Enabling Feature Access on the MapService
    • changing the map service from pooled to non-pooled
    • using a different/simple Map Service with only 1 featurelayer
    • breaking the synchronize process down to synchronizing each FeatureLayer individually with the FeatureLayerSyncAgent
    • Setting the SynchronizationDirection to SyncDirection.DownloadOnly
    • changing the WebClientProtocolType to WebClientProtocolType.SoapWebService
    • using DownloadExtent instead of Synchronize
    • compiled the application in Release (instead of debug)
    • tried it on a different Emulator
    • tried it on an actual device

    I have also discovered that in the MobileCache directory, the only file that is getting updated is the MobileCache.db-journal.

    Deleting the contents of the db-journal file (or simply deleting the file) allows the application to open the MapCache correctly. However, it does not have any of the new data from the map service.

    Somehow, the DownloadExtent/Synchronize process correctly makes a request to ArcGIS Server, gets a response back and then writes some junk in the .db-journal file, thus corrupting my local map cache and not actually getting any of the new data.

    maybe someone can explain how the process is supposed to work and how the files in the MobileCache directory are supposed to be updated to help me narrow down the problem.

    In case you are curious ... here is one example of what the db-journal is populating with:
    Code:
    ÙÕù ¡c×   ïŒe‹                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               /
       × ×                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ' #2sde.DEFAULT"  À  ÀþÿÿÿÓêÆÿïŒe‹   SQLite format 3   @     3            à                                                         <Á    ãûöñìçâÝØÓÎÉÄ¿ºµ°«¦¡œ—’ˆƒ~ytoje`[VQLGB=83-'!	ý÷ñëåßÙÓÍÇÁ                                                                                                                                          #GGEtablelayer0_current_spatial_parentlayer0_current_spatial_parentCREATE TABLE "layer0_current_spatial_parent"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER)EE9tablelayer0_current_spatial_rowidlayer0_current_spatial_rowidCREATE TABLE "layer0_current_spatial_rowid"(rowid INTEGER PRIMARY KEY, nodeno INTEGER)CC/   ށA   ځ>   Ձ:   Ё5   ́1   ǁ-   ā(   ¿&   ½"   ¸    µ   °   ®   ©   ¦   ¡   Ÿ   š   —   ’   {   ‹y   ˆt   ƒr   €m   {k   yf   te   r`   p_   k\   iY   dX   bS   ]R   ZM   UK   SG   NE   K@   F>   C9   >7   <2   71   5,   3+   .(   ,%   '$   %                      	
          ïŒf`
    Last edited by MakiG007; 03-28-2012 at 11:04 AM.

  3. #3
    Kevin Bupp
    Join Date
    May 2010
    Posts
    14
    Points
    10
    Answers Provided
    2


    0

    Default Re: Getting "Invalid file or corrupted file" Exception when Opening Map Cache after S

    I just tried this question over in the ArcGIS for Windows Phone SDK Forum and figured I would keep these two posts connected: http://forums.arcgis.com/threads/545...che-after-Sync

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts