Page 1 of 1

JSON - XPRIM_HttpRequest vs PRIM_WEB.HttpRequest

Posted: Mon Dec 02, 2019 8:34 pm
by kno_dk
Hi

I have this small solution where I integrate with a service using JSON.

It is right now called from a server module. I am using XPRIM_HttpRequest like this:
Define_Com Class(#XPRIM_HttpRequest) Name(#HttpRequest)
where I am setting some parameters like this:
#HttpRequest.Options.AddBasicAuthorization Username('XYZ') Password('abc')
#HttpRequest.Options.SetMiscProperty Name(Content-Type) Value(application/x-www-form-urlencoded)
#HttpRequest.Content.AddUrlEncodedFormValue Name('CATALOGID') Value('KNO')
#HttpRequest.Content.AddUrlEncodedFormValue Name('partnerid') Value('X2')

Could I use PRIM_WEB.HttpRequest in the same way but in a VL-web page? or is it not a way to go when I have to set the userid/password?

If it is Okay, how do i set these parameters then?

/klaus

Re: JSON - XPRIM_HttpRequest vs PRIM_WEB.HttpRequest

Posted: Mon Dec 09, 2019 1:44 pm
by Dominik
I think you answered your own question with the point about the user/password.

Typically an interaction with a webservice requires passing an API key, or user credentials etc, which is why you would normally do them on the server side (so that the client has no way to see them). Also, the source IP address may be important to the webservice (hence all requests should come from the same server).

If the user/password is values that the user has typed in, or if no authentication is required, and if the source IP address is not important, then its fine to do the requests client-side. In the end though, its up to you to decide which is more appropriate/secure.