Page 1 of 1

Non-standard HTTP Post

PostPosted: Wed Nov 04, 2009 6:05 pm
by martinh
Hi,

I need to use a HTTP Post like described below:

Code: Select all
// Attention: This is not Javascript / Servoy script. This is probably VB .Net

Dim request As HttpWebRequest = CType(WebRequest.Create("https://start.exactonline.nl/docs/XMLDivisions.aspx"), HttpWebRequest)
Dim bFormData As Byte() = Encoding.UTF8.GetBytes("_UserName_=xxx&_Password_=yyy")

request.ContentType = "application/x-www-form-urlencoded"
request.Method = "POST"
request.AllowWriteStreamBuffering = True

Dim reqStream As Stream = request.GetRequestStream()
reqStream.Write(bFormData, 0, bFormData.Length)
reqStream.Close()

Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)

If response.StatusCode = HttpStatusCode.OK AndAlso _
StrComp(response.ResponseUri.AbsoluteUri, "https://start.exactonline.nl/docs/XMLDivisions.aspx", CompareMethod.Text) = 0 Then
   'Login succeeded
Else
  'Access denied
End If


The standard Servoy HTTP-Plugin can not handle this, because one of reasons is the request.ContentType = "application/x-www-form-urlencoded"
This has been confirmed by Servoy Support.

Is there anyone who faced the same problem and found a solution to implement a post like this?

Martin

Re: Non-standard HTTP Post

PostPosted: Fri Aug 06, 2010 12:11 pm
by gabid
Hello Martin,

have you solved this issue?

I have to do the same and I would preffer to not reinvent the wheel. :D

Thanks!
Gabriel - Iulian Dumbrava

Re: Non-standard HTTP Post

PostPosted: Fri Aug 06, 2010 12:13 pm
by martinh
No this problem has never been solved.
We will try this later with Servoy 5.1 or even 5.2, but at the moment we don't have resources to do this.

Re: Non-standard HTTP Post

PostPosted: Fri Aug 06, 2010 2:16 pm
by lvostinar
martinh wrote:No this problem has never been solved.
We will try this later with Servoy 5.1 or even 5.2, but at the moment we don't have resources to do this.


In Servoy 5 we have poster.addHeader so content type can be specified. So, this should work now.