login about faq

Hello!

I'm using the chilkat android library, and wonder if it is possible to set an Entity to the CkHttp object. In pure Java it's done this way:

HttpPost post = new HttpPost(urlString);
HttpResponse response;
StringEntity se = new StringEntity(newStringFromBytes);
post.setEntity(se);
response = httpClient.execute(post);

I've tried with the PostJSON method:

JSONObject jObject = new JSONObject();
jObject.put("encodedData", newStringFromBytes);
resp = http.PostJson(urlString, jObject.toString());

But the webservice I try to contact won't accept this, and returns a HTTP 1.1/500 Internal Server Error.

I could of course used the "standard java way", but there are some neat functionality in the Chilkat library I will use in the future, regarding posting over HTTPS

Thanks in advance!

asked Jan 22 '13 at 04:15

Tobias's gravatar image

Tobias
6223


The term "entity" is a Java made-up term that corresponds to some part of the HTTP request. I don't know exactly what it is, but my guess is that it's simply the body of the MIME (i.e. everything that comes after the MIME header of the request).

Therefore, it should already be possible with Chilkat -- it's just a matter of figuring out how to get the HTTP request you desire.

My advice would be to set the http.SessionLogFilename property so that the Chilkat HTTP object logs the exact HTTP requests and responses to a file. You can then examine the file to see how the HTTP request is different than what you actually need. Feel free to post the session log information here, pointing out the part(s) of the request that do not conform to what is desired.

link

answered Jan 22 '13 at 09:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×45
×21

Asked: Jan 22 '13 at 04:15

Seen: 1,710 times

Last updated: Jan 22 '13 at 09:18

powered by OSQA