JSON - XPRIM_HttpRequest vs PRIM_WEB.HttpRequest

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Posts: 131
Joined: Tue Feb 23, 2016 12:00 am

JSON - XPRIM_HttpRequest vs PRIM_WEB.HttpRequest

Post by kno_dk » Mon Dec 02, 2019 8:34 pm


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?


Posts: 17
Joined: Fri Jun 10, 2016 12:14 pm

Re: JSON - XPRIM_HttpRequest vs PRIM_WEB.HttpRequest

Post by Dominik » Mon Dec 09, 2019 1:44 pm

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.

Post Reply