In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Not Able to use :SendRequest

Xailer English public forum
Milan Mehta
Posts: 111
Joined: Sun Dec 27, 2009 9:54 am

Not Able to use :SendRequest

Postby Milan Mehta » Fri Dec 01, 2017 12:06 pm

My following code is not working at :SendRequest().
It is able to :Open(), :Connect() and :AddReqeustHeader().
But fails at :SendRequest().

However when tried with same Parameters in PostMan it works fine.
What am I doing wrong ?

TIA
Milan.

/----------------------------------------------------------------------------------------------------------------------------
cUrl := 'http://ppgateway.filegstnow.com/gspapi/v0.2/otprequest'
cUrl := UUrlEncode( cUrl )

oInternet := TInternet():New()

WITH OBJECT oInternet
IF :Open ()
IF :Connect (cUrl)
hREquest := :OpenRequest ("POST" , cUrl)

cHeader := "state-cd:27" + CRLF
cHeader += "txn:1234567" + CRLF
cHeader += "asp_clientid:RhiCCtEsQvzwfEqM" + CRLF
cHeader += "asp_clientsecret:buxJNgTjZTKUUUGv" + CRLF
cHeader += "Content-Type:application/json" + CRLF
cHeader += "gstin:27GSPMH0501G1Z2"

:AddRequestHeader( hREquest, cHeader)

IF :SendRequest( hREquest,, cString)
MsgInfo('HttpSendRequest Successful')
ELSE
MsgInfo(' Failed to Send the Request ')
ENDIF
ELSE
MsgInfo("Could Not Open the URL " + cUrl)
ENDIF
:Close()
ELSE
MsgInfo('Could Not Connect to the URL')
ENDIF
END WITH
User avatar
ignacio
Site Admin
Posts: 8538
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Not Able to use :SendRequest

Postby ignacio » Fri Dec 01, 2017 12:41 pm

Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Milan Mehta
Posts: 111
Joined: Sun Dec 27, 2009 9:54 am

Re: Not Able to use :SendRequest

Postby Milan Mehta » Sat Dec 02, 2017 8:10 am

I did but it did not help.

Is there any Sample code which is using :AddRequestHeader(), :SendRequest() and :QueryInfo(), So that I can Send Header Parameters and Body; I also wish to get the Response in the form of JSon file.
It seems I am just one step away from achieving the same, but somehow finding it difficult to cross over.

TIA
Milan Mehta

Return to “English”