Javax Client.WebTarget: Issue creating The Request Body to support the content-type of multipart/form-data

Trying to write a ClientBuilder based method (Java/selenium tool) that handles the following condition: The Request Body for this api should be of type multipart/form-data and it should have a boundary differentiated between file attached to form and form fields

I have done the mutli Part Content in c# but the group needs to be written in Java. Here's the c# code that works for creating the request body. I just having some mental blocks writting the Java HTTP Client version (could not find any realistic samples out there)

Note: I trying to upload an application/msi or application/ms-dos-exec file via the form. Here's my c# code
		 MultipartFormDataContent multiPartContent = new
		 MultipartFormDataContent("----WebKitFormBoundaryliUiaMuaEcUBLr3A"); ByteArrayContent byteArrayContent = new
		 ByteArrayContent(LogoRequest.Content); byteArrayContent.Headers.Add("Content-Type", "image/png"); String
		 FileName = LogoRequest.Name; String ContentDispositionStr = "form-data; name=" + "\"logoImageFile\"" +"; " +
		 "filename=" + FileName; byteArrayContent.Headers.Add("Content-Disposition", ContentDispositionStr);
		 multiPartContent.Add(byteArrayContent); requestMessage.Content = multiPartContent;
		 

Open in new window

mozboonesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
I'm not sure what the question is. Are you saying you want us to translate that code into Java?
0
mozboonesAuthor Commented:
For some odd reason, I could not respond to the experts request for more information.
I was both Chrome and IE and the results were the same - no button or link to respond to the request

So, I canceled my original question.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
OK, so if the question is no longer applicable, please accept your last comment to close the question
0
mozboonesAuthor Commented:
I did not get a chance to receive a solution. There was an issue with how the solution page that prevented me from responding to the question from the Expert.

I investigating on my end to see if this a setting issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.