HTTPPost Using ardoHTTP

  
Hi,

Can someone teach me how to do HTTPPost using ardoHTTP? Thanks in advance.


Gino
Hello Gino,

ardoHTTP has an HttpPost action.

It takes a URL and Data.

Basically, if you want to post "hello I'm here" to http://<server>/endpoint you fill in the URL input with http://<server>/endpoint and "hello I'm here" to the Data input.

There are some other optional inputs which you might want to be aware of:

Content_Type to specify what kind of data you're sending (this is usually application/x-www-form-urlencoded). Username and Password if you need to perform Basic Authentication to have your POST allowed and the Headers Record List if you need some specific headers to be present in the HTTP Post request (for example, cookies and the such).

These are pretty general guidelines of how to use ardoHTTP to perform HTTP POST's. If you are having specific problems, please let us know so we can provide specific guidelines for the problem you're facing.

Best regards,
Ricardo "ardoRic" Silva
Hi Ricardo!

Awesome. Should I directly put "hello I'm here" to the Data input or something like: message="hello I'm here"? Also if I want multiple inputs how do I do that?


Thanks!
Gino

Ricardo Silva wrote:
Hello Gino,

ardoHTTP has an HttpPost action.

It takes a URL and Data.

Basically, if you want to post "hello I'm here" to http://<server>/endpoint you fill in the URL input with http://<server>/endpoint and "hello I'm here" to the Data input.

There are some other optional inputs which you might want to be aware of:

Content_Type to specify what kind of data you're sending (this is usually application/x-www-form-urlencoded). Username and Password if you need to perform Basic Authentication to have your POST allowed and the Headers Record List if you need some specific headers to be present in the HTTP Post request (for example, cookies and the such).

These are pretty general guidelines of how to use ardoHTTP to perform HTTP POST's. If you are having specific problems, please let us know so we can provide specific guidelines for the problem you're facing.

Best regards,
Ricardo "ardoRic" Silva
 
 
Hi Ricardo, 
I'm trying to make a HTTP Post, but the page is returning a error because I'm not sending right once i tried with PostMan (Chrome addon) and it got success.

Added images and a espace example

 
In PostMan i'm sending this:

 



 
and OS this:
(Tried with PostRequest_AddArgument from HTTPRequestHandler     on the left, and ardoHTTP (HTTPPost) on the right both without success



What i'm doing wrong?
ardoHTTP does not perform any transformation on the data passed to it. In particular it will not "chunk-encode" the data [1]. I believe that your problem might be that.

Is it not possible for you to post the information all in one piece using application/x-www-form-urlencoded instead ?

Otherwise you'll need to do the chunked encoding yourself, and it looks like it might be quite complicated. For a username / password form, you should probably use form-urlencoded instead.

[1] http://en.wikipedia.org/wiki/Chunked_transfer_encoding
Acutally, I double checked the code and I'm actively ignoring the Transfer-Encoding header as it has special behavior in .NET (would need to set a parameter in the .NET object and there is no such thing in Java).

You're also setting the Content-Length header which I'm ignoring in favor of calculating the content length myself from the encoding + data to be sent.

Does the page you're integrating with really require these to be set ?
Hi Ricardo,

Just tried without the headers, and the call worked (in PostMan), so the headers aren't necessary. As the previous developer had the headers, i assumed they would be required.
 
Made a new call in OS with ardoHTTP, but still give the same error because this isn't a correct POST.

I'm sending correctly the data to the extension?

The URL i have to POST is something like this:
"http://WS.internet.com/abc/Redirect.aspx?user=Luis"

The user=Luis is in Data, right?

Ricardo Silva wrote:
Acutally, I double checked the code and I'm actively ignoring the Transfer-Encoding header as it has special behavior in .NET (would need to set a parameter in the .NET object and there is no such thing in Java).

You're also setting the Content-Length header which I'm ignoring in favor of calculating the content length myself from the encoding + data to be sent.

Does the page you're integrating with really require these to be set ?
 
 
Actually, that looks like a query string.

What exactly do you want to do ? What information are you looking for? That particular URL if you access it (with HTTP GET) you'll only get redirected. Do you want your end-user to be redirected to the page? That wouldn't be using ardoHTTP which performs the request on the server side.
Ricardo,
you were right. Can't be with that code.
I was able to do it with javascript. Heres my snipet

function doSubmit(URL, UserEnconded) {
    var supertarget = URL+"?intranetuser="+UserEnconded;
    var form = $('<form id="FormPost"  action="' + supertarget + '" method="post">' +
            '<input type="text" name="IntranetUser" value="' + UserEnconded + '" />' +
            '</form>');
    $('body').append(form);
    document.getElementById("FormPost").style.display="none";
    form.submit();
}

Thanks for your help,
Regards,
Luis

Ricardo Silva wrote:

Hello Gino,

ardoHTTP has an HttpPost action.

It takes a URL and Data.

Basically, if you want to post "hello I'm here" to http://<server>/endpoint you fill in the URL input with http://<server>/endpoint and "hello I'm here" to the Data input.

There are some other optional inputs which you might want to be aware of:

Content_Type to specify what kind of data you're sending (this is usually application/x-www-form-urlencoded). Username and Password if you need to perform Basic Authentication to have your POST allowed and the Headers Record List if you need some specific headers to be present in the HTTP Post request (for example, cookies and the such).

These are pretty general guidelines of how to use ardoHTTP to perform HTTP POST's. If you are having specific problems, please let us know so we can provide specific guidelines for the problem you're facing.

Best regards,
Ricardo "ardoRic" Silva

Hi Ricardo,

I am trying to send XML using HTTPPost of ardoHTTP but I get an exception saying "Received fatal alert: protocol_version". Do you know what could be causing this?