Hello everyone, I need to control an automatic cash drawer (Cashdro).
The communication is reactivated through the web service.
There is some DLL to send data to an IP and to collect the information that returns me.
I've been watching xb2.net but I don't see how to send and receive.
I have to send calls of this type:
https://192.168.13.168/Cashdro3WS/index.php?
operation=startOperation&name=admin&password=1234&ty
pe=4&posid=terminal2&posuser=Maria¶meters={"amou
nt":"100"}
The class I have is as follows but it doesn't work for me:
CLASS WebService
EXPORTED:
// ---------------------------------------------------------------------------------
CLASS VAR hWinINet_Dll
CLASS VAR fp_InternetOpen
CLASS VAR fp_InternetOpenUrl
CLASS VAR fp_InternetReadFile
CLASS VAR fp_InternetCloseHandle
// ---------------------------------------------------------------------------------
VAR cUserAgent
VAR hInternet
VAR pBuffer
VAR nBufferSize
// ---------------------------------------------------------------------------------
INLINE CLASS METHOD initClass()
::hWinINet_Dll := DllLoad("WinINet.dll")
::fp_InternetOpen := nGetProcAddress(::hWinINet_Dll,"InternetOpenA" )
::fp_InternetOpenUrl := nGetProcAddress(::hWinINet_Dll,"InternetOpenUrlA" )
::fp_InternetReadFile := nGetProcAddress(::hWinINet_Dll,"InternetReadFile" )
::fp_InternetCloseHandle := nGetProcAddress(::hWinINet_Dll,"InternetCloseHandle")
return Self
// --------------------------------------------------------------------
INLINE METHOD init( cUserAgent , nBufferSize )
BYNAME cUserAgent DEFAULT "WEBSERVICES"
BYNAME nBufferSize DEFAULT 0x8000
::Release() // clean previous conections
::pBuffer := _xgrab( ::nBufferSize )
::hInternet := nFpCall( ::fp_InternetOpen ,::cUserAgent ,INTERNET_OPEN_TYPE_PRECONFIG ,0,0,0)
return Self
// ---------------------------------------------------------------------------------
INLINE METHOD Release()
if( !Empty(::pBuffer))
_xfree(::pBuffer) ; ::pBuffer := NIL
end
if( !Empty(::hInternet))
nFpCall( ::fp_InternetCloseHandle ,::hInternet) ; ::hInternet := NIL
end
return Self
// ---------------------------------------------------------------------------------
INLINE METHOD ReadUrl( cUrl , cHeaders , nContext)
local h := 0
local nLen := 0
local n := 0
local cRet := ""
if( Empty( cHeaders) )
cHeaders := 0
nLen := 0
else
nLen := Len(cHeaders)
end
DEFAULT nContext := 0
h := nFpCall( ::fp_InternetOpenUrl ,::hInternet , cUrl , cHeaders,nLen, 0 , nContext)
if( h != 0 )
_bset(::pBuffer,0,::nBufferSize)
if (nFpCall( ::fp_InternetReadFile ,h , ::pBuffer , ::nBufferSize , @n ) != 0)
cRet := PeekStr(::pBuffer,0,n)
end
nFpCall( ::fp_InternetCloseHandle ,h)
end
return cRet
// ---------------------------------------------------------------------------------
ENDCLASS
Thank you very much for your help
Cashdro
Re: Cashdro
If this works through a web browser it will also work with LoadFromUrl().
LoadFromUrl() is an Xbase++ function.
LoadFromUrl() is an Xbase++ function.
The eXpress train is coming - and it has more cars.
Re: Cashdro
Thank you very much Roger the function LoadFromUrl() did not work for me but it did the following code of xb2.net.
oHttp:=xbHTTPClient():new()
oHttp:Execute(cURL)
oHttp:HTTPResponse:Content
oHttp:destroy()
Miguel
oHttp:=xbHTTPClient():new()
oHttp:Execute(cURL)
oHttp:HTTPResponse:Content
oHttp:destroy()
Miguel
Re: Cashdro
Miguelon
That example works with Pablo's ot4xb. dll and you shouldn't have any connection problems.
esa clase que has colocado de ejemplo funciona con
la librería de Pablo, debes agregar ot4xb.dll
por lo que no debieras tener lios de coneccion
saludos
Héctor
That example works with Pablo's ot4xb. dll and you shouldn't have any connection problems.
esa clase que has colocado de ejemplo funciona con
la librería de Pablo, debes agregar ot4xb.dll
por lo que no debieras tener lios de coneccion
saludos
Héctor
Re: Cashdro
Are you using Xbase++ 2.0?LoadFromUrl() did not work for me
The eXpress train is coming - and it has more cars.
Re: Cashdro
Hi Hector thanks for your help
If I am using Pablo's ot4xb and the class works for me to send SMS but not to connect with Cashdro (automatic coin pad) because nothing returns me.
Nor does the function that Roger LoadFromUrl () told me work, but as Roger says I am not using Xbase 2.0 but 1.9 and maybe this is the problem.
According to the help of Xbase ++ 2.0 LoadFromUrl () it is outdated
Hola Hector gracias por tu ayuda
Si estoy utilizando ot4xb de Pablo y la clase me funciona para enviar SMS pero no para conectarme con Cashdro (cojon automatico de monedas) pues no me retorna nada.
Tampoco me funciona la funcion que me dijo Roger LoadFromUrl() pero como comenta Roger no estoy utilizando Xbase 2.0 sino la 1.9 y quizas este sea el problema.
Segun la ayuda de Xbase++ 2.0 LoadFromUrl() esta anticuada
If I am using Pablo's ot4xb and the class works for me to send SMS but not to connect with Cashdro (automatic coin pad) because nothing returns me.
Nor does the function that Roger LoadFromUrl () told me work, but as Roger says I am not using Xbase 2.0 but 1.9 and maybe this is the problem.
According to the help of Xbase ++ 2.0 LoadFromUrl () it is outdated
Hola Hector gracias por tu ayuda
Si estoy utilizando ot4xb de Pablo y la clase me funciona para enviar SMS pero no para conectarme con Cashdro (cojon automatico de monedas) pues no me retorna nada.
Tampoco me funciona la funcion que me dijo Roger LoadFromUrl() pero como comenta Roger no estoy utilizando Xbase 2.0 sino la 1.9 y quizas este sea el problema.
Segun la ayuda de Xbase++ 2.0 LoadFromUrl() esta anticuada
Re: Cashdro
Hi Miguelon
I'm going to test the example, if there's an error I'll talk to Pablo
Best Regard
Héctor
Voy a testear el ejemplo, si se produce error conversare
mañana con Pablo
Saludos
I'm going to test the example, if there's an error I'll talk to Pablo
Best Regard
Héctor
Voy a testear el ejemplo, si se produce error conversare
mañana con Pablo
Saludos