I never use this Writer because I always have trouble with it and it never clear what the problem is. Instead I use a writer to either directly write to the SDE if possible, or I use the rest endpoint of the service I want to update and use an addFeatures on it with a HTTP Caller transformer.
I never use this Writer because I always have trouble with it and it never clear what the problem is. Instead I use a writer to either directly write to the SDE if possible, or I use the rest endpoint of the service I want to update and use an addFeatures on it with a HTTP Caller transformer.
Thank you for your reply. Unfortunately I seem to be experiencing the same problem with the ArcGIS writer.
Do you have an example as to how I might be able to update data on Enterprise using the REST API and HTTP Caller? I have only used the HTTP Caller to pull data from an API before, so I'm not sure how I'd go about updating the online data layer.
Thank you.
Thank you for your reply. Unfortunately I seem to be experiencing the same problem with the ArcGIS writer.
Do you have an example as to how I might be able to update data on Enterprise using the REST API and HTTP Caller? I have only used the HTTP Caller to pull data from an API before, so I'm not sure how I'd go about updating the online data layer.
Thank you.
Okay so this is going to be a long post and it will help you with adding features to an existing feature layer, it won’t help with clearing the feature layer first. The option I am going to explain to you is one of many, but all of them are more difficult on the technical aspect than the option you were trying yourself. For example you can also use FME in combination with ArcGIS Pro to overwrite the original Feature Layer on your Enterprise portal but that requires a python script to do so.
If you want to work with the ArcGIS REST endpoint the first step is to get a token so the Enterprise Server behind portal can verify you have the correct permission to do what you want to do.
This is done by using a single feature to start a http caller which sends a request to the Token endpoint. I have added an example workbench for you.
The next step is not something I can really write out for you as a step by step plan that will just work , though I can give you a plan to hopefully figure it out from there.
1. Get the rest endpoint url for the layer you want tot update. This Url should end with something like …/FeatureServer/0
2. This is the url you are going to use in the http caller, but don’t forget to add the following text to the end of it: /addFeatures. Do not that this is case sensitive
3. The http caller method should be set tot post
4. Next you need to read the following page really well: https://developers.arcgis.com/rest/services-reference/enterprise/add-features.htm
5. You are going to send all your features into 1 http caller request so only 1 feature should enter the http caller to ensure this. You can also do it per single feature but your Enterprise Portal will not be happy with this and probably slow down and/or freeze so be careful. So before trying this you need to aggregate all your features into 1 which contains an attribute with an array of JSON information which describes all your features and attribute values for all these features. Check the dev page at point 4 to see how it must be formatted.
6. The encoding of the http body should be URL encoded I think
7. In the body you should not use any whitespace(don’t use any spacing between lines to make this readable for yourself, if you do it might not work while testing it out). It should include something like : f=json&features=@Value(AnArrayOfFeaturesInJSON)&token=@Value(TheTokenYouGotFromTheTokenRequest)
With the value of AnArrayOfFeaturesInJSON being the array you created in point 5
8. Now you add an inspector to the end of your http caller and run it with a smaller test set of data, for example start with adding 2 features. Check you result in the inspector, you will probably get a lot of errors that are about the formatting of the feature array you are sending in the body. Keep searching for small errors and tweak it until it works.
Hi @nickyaclift
I am sure that you are running into one of the 2 issues
1) You are writing to an existing Feature service that may have a schema that does not match the incoming ArcSDE (could be a simple UPPERCASE vs LOWERCASE character)
2) Or you have an attribute(e.g. INT16, DateTime, or Float) from ArcSDE which does not match that on ArcGIS Portal
I have an article(AGOL-Troubleshoot writing to existing features) that you may find useful to troubleshoot. Let me know if you have any additional questions
Hi @nickyaclift
I am sure that you are running into one of the 2 issues
1) You are writing to an existing Feature service that may have a schema that does not match the incoming ArcSDE (could be a simple UPPERCASE vs LOWERCASE character)
2) Or you have an attribute(e.g. INT16, DateTime, or Float) from ArcSDE which does not match that on ArcGIS Portal
I have an article(AGOL-Troubleshoot writing to existing features) that you may find useful to troubleshoot. Let me know if you have any additional questions
I am having the similar error when I try to update the portal feature service using feature writer:
ArcGIS Portal Feature Service Writer: 'addResults' error for a feature in 'Future_outage_v2'. The error code from the server was '10500' and the message was: 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @396f6598)'
But my script was working fine before. Do you have any ideas what caused the issue?
I am having the similar error when I try to update the portal feature service using feature writer:
ArcGIS Portal Feature Service Writer: 'addResults' error for a feature in 'Future_outage_v2'. The error code from the server was '10500' and the message was: 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @396f6598)'
But my script was working fine before. Do you have any ideas what caused the issue?
@blue_star what versions of FME & Esri Portal are you working with?
I am having the similar error when I try to update the portal feature service using feature writer:
ArcGIS Portal Feature Service Writer: 'addResults' error for a feature in 'Future_outage_v2'. The error code from the server was '10500' and the message was: 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @396f6598)'
But my script was working fine before. Do you have any ideas what caused the issue?
I am using FME 2019.2 and ESRI Enterprise 10.8.1.
I am having the similar error when I try to update the portal feature service using feature writer:
ArcGIS Portal Feature Service Writer: 'addResults' error for a feature in 'Future_outage_v2'. The error code from the server was '10500' and the message was: 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @396f6598)'
But my script was working fine before. Do you have any ideas what caused the issue?
Hi @blue_star: I wanted to share a resolution to a similar issue that a customer just shared with us today related to Esri Bug BUG-000151760 (this page contains a link to the corrected patch and alternate solution).
In their case, the problem arose after applying a security patch to their ArcGIS Portal host server. The patch introduced a bug that did not allow updates to Features in existing feature services. Refer to Esri Bug BUG-000151760 for more details and resolution.
I am having the similar error when I try to update the portal feature service using feature writer:
ArcGIS Portal Feature Service Writer: 'addResults' error for a feature in 'Future_outage_v2'. The error code from the server was '10500' and the message was: 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @396f6598)'
But my script was working fine before. Do you have any ideas what caused the issue?
Yes, the issue was caused by this bug. We have replaced the patch and the issue fixed. @nampreetatsafe, thanks for your help, much appreciated