how to get dynamic layer

3790
8
08-05-2011 12:24 AM
zhuzheng
New Contributor
guys,
  Can you get the dynamic layer in service directory in arcgis server 10.1? i use the blew json code,

{"id":15,
"source": {
  "type": "dataLayer",
   "dataSource":{
    "type":"table",
     "workspaceId":"MyShapefileWorkspaceID",
     "dataSourceName":"rail"}
}
}
but i always get the error,the error info please see the attchements.
the datasource of the services i have published is all shapefiles. the shapefiles is from arcgis turtor C:\arcgis\ArcTutor\LinearReferencing,  and i regiesterd the folder in arcgis server.
did you meet this problem in arcgis server beta? thank you very much.
0 Kudos
8 Replies
SrinivasVinnakota
Esri Contributor
jueery,
The issue you have is a bug and will be fixed. To workaround this issue you would need to edit service configuration manually.

1. Go to http://<SERVERNAME>:6080/arcgis/admin
2. Click on "Services" link and then again on the link to the map service.
3. At the bottom of the page is a link to edit this mapService. Click on the "edit" link.
4. In the edit page, find where you have "dynamicDataWorkpaces". this is a JSON array that lists all registered workpaces.
5. Add Database= before the path to the shapefile folder location, e.g. "dynamicDataWorkspaces": "[{\"id\":\"MyShapefileWorkspaceID\",\"workspaceFactory\":\"Shapefile\",\"lockVersion\":\"true\",\"workspaceConnection\":\"Database=C:\\\\arcgis\\\\ArcTutor\\\\LinearReferencing\"}]"
6. Save your edits.

After these changes the dynamicLayer definition that you have should work just fine. Make sure that server has access to the folder "C:\arcgis\ArcTutor\LinearReferencing".
0 Kudos
ErnstEijkelenboom
Esri Contributor
I have same problem.

I try is with a Filegeodatabase and a Shapefile. I manually edit the service:
[{"id":"MyFile_GDBWorkspaceID","workspaceFactory":"File GDB","workspaceConnection":"DATABASE=D:\\Data\\AG101.1\\test.gdb"},{"id":"MyShapefileWorkspaceID","workspaceFactory":"Shapefile","lockVersion":"true","workspaceConnection":"DATABASE=D:\\Data\\CBS"}]

But I can't specify the Dynamic Layer:
{"id":101,
  "source":
      {"type":"dataLayer","dataSource":
                         {"type":"table","workspaceId":"MyShapefileWorkspaceID","dataSourceName":"Provincies"}},
               "drawingInfo":{"renderer":{"type":"simple","symbol":{"type":"esriSFS","style":"esriSFSSolid","color":[166,36,50,255],"outline":{"type":"esriSLS","style":"esriSLSSolid","color":[200,110,110,255],"width":1}},
   "label":"BAG","description":""},"transparency":60},
   }

Error: Invalid or missing input parameters.

It works fine for an existing layer in the mapservice:
{
"id":502,
"source":{"type":"mapLayer","mapLayerId":2}
}


Another question:
How can you ask the mapservice wich Dynamic Data workspaces were created?
0 Kudos
SrinivasVinnakota
Esri Contributor
Update FileGeodatabase connection WorkspaceFactory value to "FileGDB" (there is no space between File and GDB).

MapService does not give out information regarding dynamic data workspaces. It is up to the server administrator or the service publisher to give this information to users.
0 Kudos
ErnstEijkelenboom
Esri Contributor
I change it:

[{"id":"MyFile_GDBWorkspaceID","workspaceFactory":"FileGDB","lockVersion":"true","workspaceConnection":"database=D:\\Data\\AG101.1\\test.gdb"}]

But still the same error.

Is this the correct syntax:

   {
    "id": 502,
    "source":
    {
      "type": "dataLayer",
      "dataSource":
      {
        "type": "table",
        "workspaceId": "MyFile_GDBWorkspaceID",
        "dataSourceName": "Panden_albrandswaard"
      }
    },
    "drawingInfo":
    {
      "renderer":
      {
        "type": "simple",
        "symbol":
        {
          "type" : "esriSFS",
          "style" : "esriSFSSolid",
          "color" : [166,36,0,255],
          "outline" :
          {
            "type" : "esriSLS",
            "style" : "esriSLSSolid",
            "color" : [110,110,110,255],
            "width" : 1.0
          }
        },
        "label": "Test",
        "description": ""
      },
      "transparency": 60
    }
  }
0 Kudos
SrinivasVinnakota
Esri Contributor
There is nothing wrong in the dynamic layer syntax that you posted.

[{"id":"MyFile_GDBWorkspaceID","workspaceFactory":"FileGDB","lockVersion":"true","workspaceConnection":"database=D:\\Data\\AG101.1\\test.gdb"}]


When you edited map service configuration did you copy-paste the above string? If yes, then I think you have an invalid configuration. To be sure when you edit "dynamicDataWorkspaces" property in the mapservice configuration editor you should see 4 back-slashes.

1. Click on "Edit" link to edit map service configuration.
2. Find the line that lists "dynamicDataWorkspaces".
3. Edit MyFile_GDBWorkspaceId "workspaceConnection" property to [{"id":"MyFile_GDBWorkspaceID","workspaceFactory":"FileGDB","lockVersion":"true","workspaceConnection":"database=D:\\\\Data\\\\AG101.1\\\\test.gdb"}]

If this does not fix the issue then check the folder permissions to make sure Server has access to the file geodatabase.
0 Kudos
ErnstEijkelenboom
Esri Contributor
It works now! Thanks.

When are the Web APIs available in Beta to test the dynamic Layers?
0 Kudos
SrinivasVinnakota
Esri Contributor
These should be available in the next couple of months.
0 Kudos
zhuzheng
New Contributor
Vinnakota�?thank you very much. it works. i can get dynamic layers now!
0 Kudos