Hi Kevin,
I'm also getting the 000816 error when running my published service. But when I try your suggestion (running it from C:\arcgisserver\directories\arcgissystem\arcgisinput\{service name}.GPServer\extracted\v101\{folder name}) I'm getting the following error:
The value does not exist.
ERROR 000732: Template Feature Class: Dataset ServiceName\LayerA does not exist or is not supported.
That occurs in the Create Feature Class function in my model.
I dragged a layer from a mxd to be assigned to the template feature class parameter of this function in the model. Its data source uses a database connection that is registered in the server.
In the C:\arcgisserver\directories\arcgissystem\arcgisinput\{service name}.GPServer\extracted\v101\{folder name} folder I see that the connection file (.sde) is copied so I don't know why it can't found the Layer. Also in the original model, since the MXD is opened when I run it, the reference to the layer is only "LayerA", but in the tool in the published folder the reference changes to "ServiceName\LayerA".
Do you have an idea of what could be happening?
Regards
Sergio,
Based on the error - I'm going to guess you're using the tool in that directory, not the result. The only way you could test run this would be from that directory to drag the RLT into the results window -- this should also add data the the map, then you'd be able to run the tool inside the toolbox, or the result inside the Shared node of the result window. (You need to do this when you've used layers). The ServiceName\LayerA that the GP services expects is correct; the service internally changes this and knows where the data is. As I said, if you add the RLT to your session, you should see a GroupLayer\Layer Name in this way get added. If that layer is broken, you're on your way to identifying your issue. However I suspect this layer will connect fine.
Without knowing much more about your situation, I'd go back and evaluate if you actually need the CreateFeatureClass tool. This tool can be tricky to use in a GP Service as it takes a workspace input parameter and creates derived output. Could you instead use another tool to achieve your goal, maybe CopyFeatures?
Thanks Kevin for your prompt answer. Now I understand better how the published service works. As you said, I tried dragging the RLT to the session and the tool connected fine to the layer and executed correctly.
I was trying to change the use of CreateFeatureClass to CopyFeatures, but I don't think it works, since what I want the tool to do is to receive a SHP file (that can have custom attributes) and append it to my layer so it would have only the attributes of my layer. That's why I was using CreateFeatureClass to create an empty feature class based on my layer, then append the received SHP file, use the CalculteField tool to complete one field and then append this result to the actual layer.
When I use CopyFeatures the features from the SHP file keep their custom attributes and cannot be appended to my layer.
Do you know how can I set the workspace via parameter or other way to the CreateFeatureClass tool to work? Or another way to get the same result with the CopyFeatures or different tools?
Thanks!
How about you just have an empty featureclass already created and have that hardcoded in your model/script as project data. The append works off this data + the data the user supplies to the service.
You cannot supply a workspace parameter to a tool in a GP Service. This will always become hardcoded.
Thanks Kevin, I'll try your suggestion. But also I have a question about the workspace, because I was using "in_memory" as Feature Class Location for the CreateFeatureClass tool. Is this not kind of setting "in_memory" as the workspace for the tool?