HTTP Post

Hi,

Do any of you have experience with HTTP Post from Natural for windoes ?

I have tried “Msxml2.XMLHTTP”, “Microsoft.XMLHTTP” and “WinHttp.WinHttpRequest”.

The first two gives me a parameter error (using datatype (A) or (B). I need to send the ‘request’ as binary), and the last one do not give me the expected result when using a variable as parameter.

Eksample :
CREATE OBJECT #Object OF CLASS “WinHttp.WinHttpRequest.5.1”

send ‘open’ to #Object
with ‘POST’ request-string ‘false’ (request-string is the URL (A))

send ‘send’ to #Object
with my-request (my-request is the ‘body’ (A) or (B))

SEND “ResponseText” TO #Object
RETURN Response-text (Response-text is the response (A))

I have tried to set the Content-type in the RequestHeader.

One strange ting is that if I do like this : (Not using a variable to hold the request)

send ‘send’ to #Object
with “The request”

It works…

Regards Claus

It seems that the method you are calling insists on receiving the parameter ‘by value’, not ‘by reference’. If you pass a variable to a method (subprogram, … etc.), Natural passes the variable ‘by reference’, unless you use the option (AD=O). So I would give it a try and use (AD=O) when passing the variable. Hint: In order to see what exactly you have to pass to a method, you can consult Natural’s Component Browser. Good luck, +o:-]

Bennedict, you are the best !!!

I have searched for hours, I have been through the component browser 1000 times, I have tried several objects…

And then, it’s just a simple thing. :oops:

Thanks, a beer is added to your account… 8)

Claus