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
Responder
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Not Able to use :SendRequest

Mensaje por Milan Mehta »

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
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not Able to use :SendRequest

Mensaje por ignacio »

Hi,

Check the error reported by the class: nLastError and nStatusCode.

https://support.microsoft.com/en-us/hel ... ough-12156
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not Able to use :SendRequest

Mensaje por Milan Mehta »

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
Responder