AnsweredAssumed Answered

Calling REST service to add catalog item in ArcGIS10.1

Question asked by nikhil.sharma on May 28, 2012
Latest reply on Jun 13, 2012 by nikhil.sharma
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();
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

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

Thanks in advance.