exportJob failing to get server id

1063
5
10-02-2017 07:41 AM
NicholasLiccini
New Contributor II

Hi!

I am using the ExportTileCacheTask to create a tile package of the built in Esri basemaps, and I keep getting an error saying: "Job failed. Job error 6 Illegal state. Server response is missing a job id."

I'm not sure why the server won't provide a correct id for the job, so if anyone has any advice it would be greatly appreciated!

Thanks!

Nick 

0 Kudos
5 Replies
LucasDanzinger
Esri Frequent Contributor

Can you post some code or additional details? 

0 Kudos
NicholasLiccini
New Contributor II

Below is the code I'm using that should 1) open a portal to ArcGIS Online, 2) prepare an export task with the Url of the basemap that I'd like to download, and 3) export the basemap.

I use the AuthenticationManager QML item to take in my credentials to my ArcGIS Developer account which it accepts, my only error is the one above and I'm not sure what the problem could be. Perhaps it is a network permissions issue?


Portal* portal = new Portal(QUrl("https://arcgis.com"), true, this);
connect(portal, &Portal::doneLoading, this, [this](Error error){
  if (!error.isEmpty())
    qDebug() << error.message() << error.additionalMessage();
  else
    qDebug() << "Portal loaded!";
});
p_ExportTask_ = new ExportTileCacheTask(QUrl("https://tiledbasemaps.arcgis.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer"), this);
connect(p_ExportTask_, &ExportTileCacheTask::doneLoading, this, [this](Error error){
    if(!error.isEmpty()){
        qDebug() << "ExportTask load error: " << error.message() << error.additionalMessage();
    }
});
Geometry view = p_MapView_->visibleArea();
view = GeometryEngine::project(view, SpatialReference::webMercator());
connect(p_ExportTask_, &ExportTileCacheTask::defaultExportTileCacheParametersCompleted, this, [this, path](QUuid, ExportTileCacheParameters params){
        p_ExportParams_ = params;
        ExportTileCacheJob* exportJob = p_ExportTask_->exportTileCache(p_ExportParams_, path);
        if(exportJob){
            connect(exportJob, &ExportTileCacheJob::jobStatusChanged, this, [this, exportJob](){
                QList<JobMessage> msgs;
                switch(exportJob->jobStatus()){
                    case JobStatus::Failed:
                        std::cout << "Failed :(" << std::endl;
                        msgs = exportJob->messages();
                        for(int i = 0; i < msgs.size(); i++){
                            JobMessage msg = msgs.at(i);
                            std::cout << msg.message().toStdString() << std::endl; //This is where the error occurs 
                        }
                        break;
                    case JobStatus::Paused:
                        std::cout << "Export paused." << std::endl;
                        break;
                    case JobStatus::Started:
                        std::cout << "Export in progress..." << std::endl;
                        break;
                    case JobStatus::Succeeded:
                        std::cout << "Export succeeded!" << std::endl;
                        loadExportedMap(exportJob->result()); // This
                        break;
                }
            });
            // Start the job
            exportJob->start();
        }else{
            std::cout << "Export job is invalid, task aborted." << std::endl;
            return;
        }
    });
    p_ExportTask_->createDefaultExportTileCacheParameters(view, p_MapView_->mapScale(), p_ExportTask_->mapServiceInfo().maxScale());
void MyApp::loadExportedMap(TileCache *cache){ // Method to load the basemap and display it
    if(cache){
        ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(cache, this);
        Basemap* basemap = new Basemap(tiledLayer, this);
        p_Map_->setBasemap(basemap);
        std::cout << "Tile package loaded successfully!" << std::endl;
    }else{
        std::cout << "The cache is invalid." << std::endl;
    }
}
0 Kudos
LucasDanzinger
Esri Frequent Contributor

Can you try connecting to the ExportTileCacheTask's errorOccurred signal to see if you get any more details? Also, you could try using Fiddler to monitor the http responses to see if you can get any more clues 

0 Kudos
NicholasLiccini
New Contributor II

I will put that in and see what errors are occurring. What is Fiddler and how can I use it?

Thanks!

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Fiddler - Free Web Debugging Proxy - Telerik 

It is a web debugging tool that helps you monitor the http traffic. There are other options as well, such as Charles.

0 Kudos