Issue in uploading assest using jersey API

Hi Nitai,

I am getting following error while uploading assest to razuna.

1 * Client out-bound request
1 > POST …http://digital.razuna.com//index.cfm
1 > Content-Type: multipart/form-data
–Boundary_1_12502079_1412100837775
Content-Type: text/plain
Content-Disposition: form-data; name=“fileDescription”

test
–Boundary_1_12502079_1412100837775
Content-Type: text/plain
Content-Disposition: form-data; name=“filename”

iskcon.txt
–Boundary_1_12502079_1412100837775
Content-Type: text/plain
Content-Disposition: form-data; name=“fa”

c.apiupload
–Boundary_1_12502079_1412100837775
Content-Type: text/plain
Content-Disposition: form-data; name=“api_key”

--Boundary_1_12502079_1412100837775 Content-Type: text/plain Content-Disposition: form-data; name="destfolderid" --Boundary_1_12502079_1412100837775 Content-Type: text/plain Content-Disposition: form-data; name="zip_extract"

1
–Boundary_1_12502079_1412100837775
Content-Type: multipart/form-data
Content-Disposition: form-data; filename=“iskcon.txt”; modification-date=“Sat, 09 Jun 2012 15:48:55 GMT”; size=199; name=“filedata”
content of file
–Boundary_1_10509251_1412102088947–

1 * Client in-bound response
1 < 200
1 < Transfer-Encoding: chunked
1 < Date: Tue, 30 Sep 2014 18:34:48 GMT
1 < Expires: Wed, 01 Oct 2014 18:34:48 GMT
1 < Keep-Alive: timeout=5, max=497
1 < Via: 1.1 razuna.razuna.com
1 < Set-Cookie: LOGINPASS=; path=/
1 < Set-Cookie: LOGINNAME=; path=/
1 < Set-Cookie: JSESSIONID=26387AD5CF35393D44996767E2743C8C; Path=/; HttpOnly
1 < Connection: Keep-Alive
1 < Content-Type: application/xml;charset=UTF-8
1 < Server: Razuna Application Server
1 < Cache-Control: max-age=86400
1 <

<?xml version="1.0" encoding="UTF-8"?> 1 Upload failed There was no appropriate FILE found in the upload

Output from Server …

<?xml version="1.0" encoding="UTF-8"?> 1 Upload failed There was no appropriate FILE found in the upload

The error is stating that it could not find the file uploaded.
Please follow the instructions on this page http://wiki.razuna.com/display/ecp/Upload+API2.
At the bottom there is a sample code that you can modify and use.

Thanks harkirat for your prompt response.

i am using jersey api for uploading file in razuna and following is the code used for uploading :

public static String executeMultiPartRequest(String urlString, File file,
String fileName, String fileDescription, String folderId) {

	try {

		ClientConfig cc = new DefaultClientConfig();
		Client client = Client.create(cc);
		client.addFilter(new LoggingFilter(System.out));

		WebResource webResource = client.resource(urlString);

		FormDataMultiPart formDataMultiPart = new FormDataMultiPart();
		
		

		formDataMultiPart.field("fileDescription","test");
		formDataMultiPart.field("filename", file.getName());
		formDataMultiPart.field("fa", "c.apiupload");
		formDataMultiPart.field("api_key",<removed for privacy>);
		formDataMultiPart.field("destfolderid", folderId);
		formDataMultiPart.field("zip_extract", "1");
	   
		FileDataBodyPart fdp = new FileDataBodyPart("filedata", file,MediaType.MULTIPART_FORM_DATA_TYPE);
		
		
		formDataMultiPart.bodyPart(fdp);
		

		ClientResponse response = webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, formDataMultiPart);
		
		if (response.getStatus() != 200) {
			throw new RuntimeException("Failed : HTTP error code : "
					+ response.getStatus());
		}

		System.out.println("Output from Server .... \n");
		String output = response.getEntity(String.class);
		System.out.println(output);

	} catch (Exception e) {

		e.printStackTrace();

	}

	return "success";

	
} 

i have used same code with different parameter fields and i was able to successfully upload file on other content management server but it doesn’t work with razuna.

It could be a permissions issue on your server. Please see this thread https://groups.google.com/forum/#!topic/openbd/GOvvCYQzQVA

since i was facing issue with jersey api, i tried with Apache httpclient api and file got uploaded successfully on Razuna.

can you help me in understanding what could be the issue with jersey api as i am able to perform upload on other content management system with the code mentioned above.

Sorry we can’t help any further. We are not familiar with the Jersey API and this request is beyond the scope of support that we provide without a support contract.

Jersey api’s are widely used api’s for calling RESTFul webservice.

just wanted to know can we pass the upload file as stream on to Razuna using your api

Razuna upload api expects a regular http file upload.