Calling REST service to add catalog item in ArcGIS10.1

2351
2
Jump to solution
05-28-2012 08:51 PM
NikhilSharma2
New Contributor
Hi there.
I want to call ArcGIS REST service to a new catalog item using my java code. The REST service is to add a new catalog which is a POST only service. I am sending the data while calling the service, but the issue arises while sending the raster image data. The service is not saving the raster file I am sending as byte array using my java code. It gives an error message "Invalid or missing parameter", but the same file works fine when I upload it using web UI form of the service.
When I send the data excluding the raster image, the data gets updated successfully. Below is the code I am using.

FormDataMultiPart formData;
formData = new FormDataMultiPart();
formData.field("f"="json").field(file1, imageByteArray, MediaType.APPLICATION_OCTET_STREAM_TYPE);

ClientConfig config = new DefaultClientConfig();
config.getClasses().add(MultiPartWriter.class);
Client client = Client.create(config);
WebResource service = client.resource(url);
ClientResponse response = service.entity(formData).type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class);


The description of the REST service can be found at http://servicesbeta2.esri.com/arcgis/sdk/rest/isadd.html

Am I missing any parameter or there is any other way to send the raster image file to the service?


Thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
WenxueJu
Esri Contributor
It seems rasterType parameter is missing in the request, it's needed as it defines how rasters are added to the backend mosaic dataset. By the way, the addRaster API has been changed in 10.1 final release to streamline the editing workflow and better support file uploading. In final release, image services that have editing capability will expose a publically accessible uploads resource (similar to http://servicesbeta2.esri.com/arcgis/sdk/rest/uploads.html). The image service editing operations (add, update) will no longer take files as part of the request; instead, both operations take itemId (from uploads). Essentially it's a two step process: upload imagery and add raster.

10.1 final is available soon: http://betablogs.esri.com/beta/arcgis/2012/06/

View solution in original post

0 Kudos
2 Replies
WenxueJu
Esri Contributor
It seems rasterType parameter is missing in the request, it's needed as it defines how rasters are added to the backend mosaic dataset. By the way, the addRaster API has been changed in 10.1 final release to streamline the editing workflow and better support file uploading. In final release, image services that have editing capability will expose a publically accessible uploads resource (similar to http://servicesbeta2.esri.com/arcgis/sdk/rest/uploads.html). The image service editing operations (add, update) will no longer take files as part of the request; instead, both operations take itemId (from uploads). Essentially it's a two step process: upload imagery and add raster.

10.1 final is available soon: http://betablogs.esri.com/beta/arcgis/2012/06/
0 Kudos
NikhilSharma2
New Contributor
Thanks for the replay Wenxue.
The information was useful.
0 Kudos