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);
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.
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.