Was trying with the Automation utils. But couldn't do this so I implemented
following code (Working) with httpclient. But only concern is there are lot
of depcrated classes used here. So are there any better way to implement
this.
@Manjula : any concerns?

HttpClient httpclient = new DefaultHttpClient();

HttpPost httppost = new HttpPost(endpoint);

MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart(PARAM_NAME_FILEUPLOAD, new FileBody(uploadArtifact));
reqEntity.addPart(PARAM_NAME_ACTION, new StringBody(CREATE_APPLICATION_ACTION));
reqEntity.addPart(PARAM_NAME_APPLICATION_NAME, new StringBody(applicationName));
reqEntity.addPart(PARAM_NAME_APPLICATION_DESCRIPTION, new
StringBody(applicationDescription));
reqEntity.addPart(PARAM_NAME_RUNTIME, new StringBody(runtime));
reqEntity.addPart(PARAM_NAME_APP_TYPE_NAME, new StringBody(appTypeName));
reqEntity.addPart(PARAM_NAME_APPLICATION_REVISION, new
StringBody(applicationVersion));
reqEntity.addPart(PARAM_NAME_UPLOADED_FILE_NAME, new
StringBody(uploadedFileName));
reqEntity.addPart(PARAM_NAME_PROPERTIES, new StringBody(runtimeProperties));
reqEntity.addPart(PARAM_NAME_TAGS, new StringBody(tags));
reqEntity.addPart(PARAM_NAME_IS_FILE_ATTACHED, new
StringBody(Boolean.TRUE.toString()));//Setting true to send the file
in request

httppost.setEntity(reqEntity);

httppost.setHeader(HEADER_COOKIE, getRequestHeaders().get(HEADER_COOKIE));

org.apache.http.HttpResponse response = httpclient.execute(httppost);


Thanks & Regards
Danushka Fernando
Senior Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729

On Thu, Mar 10, 2016 at 12:28 PM, Manuranga Perera <[email protected]> wrote:

> Does it work if you upload through the browser?
> If yes, put tcpmon in-front and see how your request is different form the
> browser request.
>
> On Thu, Mar 10, 2016 at 11:38 AM, Danushka Fernando <[email protected]>
> wrote:
>
>> Hi All
>> I am trying to do $subject for a test case. Tried with sending the file
>> and the file input stream. Both didn't work. What should I send here. In
>> Jaggery side its retrieving by request.getFile().
>>
>> Thanks & Regards
>> Danushka Fernando
>> Senior Software Engineer
>> WSO2 inc. http://wso2.com/
>> Mobile : +94716332729
>>
>
>
>
> --
> With regards,
> *Manu*ranga Perera.
>
> phone : 071 7 70 20 50
> mail : [email protected]
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to