rmarra
-
Posts
412 -
Joined
-
Last visited
Posts posted by rmarra
-
-
Estou usando esta classe para fazer conexão webservice.
Porém preciso utiliza-la tb. para quem tem proxy.
Alguém poderia ajudar de como proceder?
Desde já agradeço!
CLASS TdWebService
DATA hOpen
DATA sbuffer HIDDEN
DATA xDLL HIDDEN
METHOD New(buffersize) CONSTRUCTOR
METHOD OpenWS(url)
METHOD End()
ENDCLASS
*****************************
METHOD New(conexion,buffersize) CLASS TdWebService
DEFAULT buffersize:=3200
::sbuffer:=buffersize
xDll:=LoadLib32("wininet.dll")
::hOpen = InternetOpen("TdWebService", 1,,, 0)
RETURN Self
*****************************
METHOD OpenWS(url) CLASS TdWebService
local hFile,ret,xml
hFile = InternetOpenUrl(::hOpen, url,"",0,,0)
xml:=space(::sbuffer)
InternetReadFile(hFile, @xml, ::sbuffer, @Ret)
return subst(alltrim(xml),1,len(alltrim(xml))-2)
*****************************
METHOD End() CLASS TdWebService
FreeLib32(xDll)
return nil
*****************************
DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
n4 AS DWORD ) AS LONG PASCAL ;
FROM "InternetOpenA" LIB xdll
Dll32 Function InternetReadFile(hFile As 7, @sBuffer As 8, lNumBytesToRead As 7, @lNumberOfBytesRead As 7) As 7 PASCAL Lib xdll
Dll32 Function InternetOpenUrl(hInternetSession As 7, lpszUrl As 8, lpszHeaders As 8, dwHeadersLength As 7, dwFlags As 7, dwContext As 7) As 7 FROM "InternetOpenUrlA" PASCAL Lib xdll
DLL32 FUNCTION InternetCloseHandle( hSession AS LONG ) AS BOOL PASCAL LIB xdll
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Podem desconsiderar. Resolvido conforme abaixo:
Grato!
********************************************************************************
static procedure Enviaftp()
********************************************************************************
LOCAL n
LOCAL cUrl
LOCAL cStr
LOCAL lRetorno := .T.
LOCAL oUrl
LOCAL oFTP
LOCAL cUser
LOCAL cServer
LOCAL cPassword
LOCAL cFile := ""
LOCAL lElim
DEFAULT lElim TO .F.
if !net_use("CONFIG")
return
endif
cServer := alltrim(PHL_SERV)
cUser := alltrim(PHL_USU)
cPassword := alltrim(PHL_SENHA)
cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer
cEnvOrig := "\pharmali\envio\phl.txt"
cEnvDest := "/envio/phl99_" + str(year(date()),4) + ;
substr(dtoc(date()),4,2) + left(dtoc(date()),2) + ;
left(strtran(time(),":"), 2) + ;
substr(strtran(time(),":"),3,2) + ;
substr(strtran(time(),":"),5,2) + ".txt"
if file(cEnvOrig)
oUrl := tUrl():New( cUrl )
oFTP := tIPClientFtp():New( oUrl, .T. )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .T.
// Comprobamos si el usuario contiene una @ para forzar el userid
if At( "@", cUser ) > 0
oFTP:oUrl:cServer := cServer
oFTP:oUrl:cUserID := cUser
oFTP:oUrl:cPassword := cPassword
endif
// function for displaying progress bar
oFtp:exGauge := ( @FtpProgress() )
if oFTP:Open( cUrl )
if !oFtp:UploadFile( cEnvOrig, cEnvDest )
lRetorno := .F.
else
lRetorno := .t.
endif
oFTP:Close()
if lRetorno
msg( "Enviado com sucesso !" )
else
msg( "Falha no Envio !" )
endif
else
cStr := "Não consegui conectar com o servidor FTP" + " " + oURL:cServer + ";;"
if oFTP:SocketCon == NIL
cStr += "Conexão não inicializada"
elseif InetErrorCode( oFTP:SocketCon ) == 0
cStr += "Resposta do servidor:" + " "+ oFTP:cReply
else
cStr += "Erro na conexão:" + " " +InetErrorDesc( oFTP:SocketCon )
endif
msg(cStr)
endif
else
msg("Não existe arquivo para ser enviado.")
endif
close CONFIG
return Nil
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Olá pessoal, alguém poderia postar um exemplo prático e que funcione de Envio e Recebimento de arquivos via FTP em Harbour?
Abaixo a classe que utilize e o programa de envio e recebimento.
Estranho que conecto no servidor, porém não consigo enviar e nem receber arquivos.
Desde já agradeço!
==> Classe que utilizo.
// FiveWin Class TFTP for Internet FTP management. Based on Windows WinINet.dll
#include "FiveWin.ch"
#include "Struct.ch"
#define INTERNET_SERVICE_FTP 1
#define FTP_PORT 21
//----------------------------------------------------------------------------//
CLASS TFTP
DATA oInternet // TInternet container object
DATA cSite // URL address
DATA hFTP // handle of the FTP connection
DATA cUserName // user name to login
DATA cPassword // password to login
METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CONSTRUCTOR // generic constructor
METHOD End() // generic destructor
METHOD DeleteFile( cFileName ) // deletes a remote FTP file
METHOD Directory( cMask ) // as Clipper Directory() but on a FTP site!
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CLASS TFTP
::oInternet = oInternet
::cSite = cFTPSite
::cUserName = cUserName
::cPassword = cPassword
if oInternet:hSession != nil
::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;
::cUserName, ::cPassword,;
INTERNET_SERVICE_FTP, 0, 0 )
AAdd( oInternet:aFTPs, Self )
endif
return Self
//----------------------------------------------------------------------------//
METHOD End() CLASS TFTP
if ::hFTP != nil
InternetCloseHandle( ::hFTP )
::hFTP = nil
endif
return nil
//----------------------------------------------------------------------------//
METHOD DeleteFile( cFileName ) CLASS TFTP
return If( ::hFTP != nil, FtpDeleteFile( ::hFTP, cFileName ), .f. )
//----------------------------------------------------------------------------//
METHOD Directory( cMask ) CLASS TFTP
local hFTPDir, aFiles := {}
local oWin32FindData, cBuffer
DEFAULT cMask := "*.*"
STRUCT oWin32FindData
MEMBER nFileAttributes AS DWORD
MEMBER nCreationTime AS STRING LEN 8
MEMBER nLastReadAccess AS STRING LEN 8
MEMBER nLastWriteAccess AS STRING LEN 8
MEMBER nSizeHight AS DWORD
MEMBER nSizeLow AS DWORD
MEMBER nReserved0 AS DWORD
MEMBER nReserved1 AS DWORD
MEMBER cFileName AS STRING LEN 260
MEMBER cAltName AS STRING LEN 28
ENDSTRUCT
if ::hFTP != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )
oWin32FindData:cBuffer = cBuffer
if ! Empty( oWin32FindData:cFileName )
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow } )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow } )
end
endif
InternetCloseHandle( hFTPDir )
endif
return aFiles
==> Meu programa de Envio e Recebimento.
****************************************************************************
procedure Ftp()
****************************************************************************
/*
// Enviar e receber arquivos via FTP da Pharmalink.
// Rondinelli - 02/07/2009
*/
if DeCriptWord( Get4Ini("PHL","LHPEP" ,"C:\RCACFG.INI")) # "SIM"
msg("PE Pharmalink não habilitado.")
return Nil
endif
VerFTP()
****************************************************************************
static function VerFTP()
****************************************************************************
private cServidor, cUsuario, cSenha
if !net_use("CONFIG")
return
endif
cServidor := alltrim(PHL_SERV)
cUsuario := alltrim(PHL_USU)
cSenha := alltrim(PHL_SENHA)
oInternet := TInternet():New()
oFTP := TFTP():New( cServidor, oInternet, cUsuario, cSenha )
if oInternet:hSession # Nil
if !Empty( oFTP:hFTP )
//Abriu o Ftp
MandaArq(oFtp,oInternet)
RecebArq(oFtp,oInternet)
else
msg("Sem Acesso ao FTP.")
endif
else
msg("Sem Acesso a Internet.")
endif
oInternet:End()
oFtp:End()
close CONFIG
return Nil
****************************************************************************
static function MandaArq(oFtp,oInternet)
****************************************************************************
local nTotal, hSource, cBuffer := Space( 6400 ), nBufSize := 6400,;
oFile
cEnvOrig := "\pharmali\envio\phl.txt"
cEnvDest := "/" + cUsuario + "/envio/phl99_" + str(year(date()),4) + ;
substr(dtoc(date()),4,2) + left(dtoc(date()),2) + ;
left(strtran(time(),":"), 2) + ;
substr(strtran(time(),":"),3,2) + ;
substr(strtran(time(),":"),5,2) + ".txt"
hSource := FOpen( cEnvOrig )
if !file(cEnvOrig)
msg("Arquivo para envio não existe.")
return Nil
endif
barra("Enviando arquivo " + cEnvOrig + " para " + cEnvDest + "...")
cBuffer := Space( 6400 )
nBufSize := 6400
SysRefresh()
msg(cEnvDest)
oFile := TFtpFile():New( cEnvDest, oFTP )
if Empty(oFile)
msg("Erro na criação do arquivo no FTP.")
return Nil
endif
oFile:OpenWrite()
FSeek( hSource, 0, 0 )
nTotal := 0
while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0
nFeito := oFile:Write( SubStr( cBuffer, 1, nBytes ) )
barra("Enviando arquivo " + cEnvOrig + " para " + cEnvDest + " -> " + alltrim(str(nBufSize)) + "...")
SysRefresh()
nTotal += nBufSize
end
oFile:End()
FClose( hSource )
msg("Arquivo com " + transform(nTotal,"9,999,999,999") + " Bites enviado com sucesso...")
barra("")
ferase(cEnvOrig)
return Nil
****************************************************************************
static function RecebArq(oFtp,oInternet)
****************************************************************************
local nX, hTarget, cBuffer := Space( 6400 ), nBufSize := 6400 ,;
aVerFiles, nSeconds, nFeito := 0, cArqRec, cArqEnv, lErro, nTot,;
nArq := 1
aVerFiles := oFTP:Directory("/" + cUsuario + "/Retorno/*.RET" )
aVerFiles := ASort(aVerFiles,,,{|x,y| x[1] < y[1]})
barra("Recebendo arquivo de retorno...")
For nX := 1 To Len(aVerFiles)
cArqEnv := "/" + cUsuario + "/Retorno/" + aVerFiles[nX][1]
do while .t.
cArqRec := "\PHARMALI\RETORNO\PHL" + strzero(nArq,5) + ".RET"
if file(cArqRec)
nArq++
loop
endif
exit
enddo
cBuffer := Space( 6400 )
nBufSize := 6400
//---- Recebe o arquivo do FTP ----//
hTarget := FCreate( cArqRec )
oFile := TFtpFile():New( cArqEnv, oFTP )
If oFile # Nil
oFile:OpenRead()
nSeconds := Seconds()+600
nTot := 0
lErro := .F.
while ( nBytes := Len( cBuffer := oFile:Read( nBufSize ) ) ) > 0
FWrite( hTarget, cBuffer, nBytes )
SysRefresh()
nTot += nBytes
If Seconds() > nSeconds
lErro := .T.
Endif
end
FClose( hTarget )
oFile:End()
if !lErro
if nTot = 0
loop
endif
msg("Recebidos " + transform(nTot,"9,999,999,999") + " Bytes.")
FClose( hTarget )
//---- Elimina do Diretório do FTP ----//
oFtp:DeleteFile( cArqEnv )
++nFeito
else
msg("Erro lendo arquivo " + cArqEnv + ".")
return Nil
endif
else
msg("Não foi possÃvel abrir o arquivo " + cArqEnv + ".")
return Nil
endif
Next
if nFeito == 0
msg("Não houve arquivo para receber.")
endif
barra()
Return Nil
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
Editado por - rmarra on 29/06/2011 10:18:04
-
Olá pessoal, alguém poderia postar um exemplo prático e que funcione de Envio e Recebimento de arquivos via FTP em Harbour?
Abaixo a classe que utilize e o programa de envio e recebimento.
Estranho que conecto no servidor, porém não consigo enviar e nem receber arquivos.
Desde já agradeço!
==> Classe que utilizo.
// FiveWin Class TFTP for Internet FTP management. Based on Windows WinINet.dll
#include "FiveWin.ch"
#include "Struct.ch"
#define INTERNET_SERVICE_FTP 1
#define FTP_PORT 21
//----------------------------------------------------------------------------//
CLASS TFTP
DATA oInternet // TInternet container object
DATA cSite // URL address
DATA hFTP // handle of the FTP connection
DATA cUserName // user name to login
DATA cPassword // password to login
METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CONSTRUCTOR // generic constructor
METHOD End() // generic destructor
METHOD DeleteFile( cFileName ) // deletes a remote FTP file
METHOD Directory( cMask ) // as Clipper Directory() but on a FTP site!
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CLASS TFTP
::oInternet = oInternet
::cSite = cFTPSite
::cUserName = cUserName
::cPassword = cPassword
if oInternet:hSession != nil
::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;
::cUserName, ::cPassword,;
INTERNET_SERVICE_FTP, 0, 0 )
AAdd( oInternet:aFTPs, Self )
endif
return Self
//----------------------------------------------------------------------------//
METHOD End() CLASS TFTP
if ::hFTP != nil
InternetCloseHandle( ::hFTP )
::hFTP = nil
endif
return nil
//----------------------------------------------------------------------------//
METHOD DeleteFile( cFileName ) CLASS TFTP
return If( ::hFTP != nil, FtpDeleteFile( ::hFTP, cFileName ), .f. )
//----------------------------------------------------------------------------//
METHOD Directory( cMask ) CLASS TFTP
local hFTPDir, aFiles := {}
local oWin32FindData, cBuffer
DEFAULT cMask := "*.*"
STRUCT oWin32FindData
MEMBER nFileAttributes AS DWORD
MEMBER nCreationTime AS STRING LEN 8
MEMBER nLastReadAccess AS STRING LEN 8
MEMBER nLastWriteAccess AS STRING LEN 8
MEMBER nSizeHight AS DWORD
MEMBER nSizeLow AS DWORD
MEMBER nReserved0 AS DWORD
MEMBER nReserved1 AS DWORD
MEMBER cFileName AS STRING LEN 260
MEMBER cAltName AS STRING LEN 28
ENDSTRUCT
if ::hFTP != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )
oWin32FindData:cBuffer = cBuffer
if ! Empty( oWin32FindData:cFileName )
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow } )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow } )
end
endif
InternetCloseHandle( hFTPDir )
endif
return aFiles
==> Meu programa de Envio e Recebimento.
****************************************************************************
procedure Ftp()
****************************************************************************
/*
// Enviar e receber arquivos via FTP da Pharmalink.
// Rondinelli - 02/07/2009
*/
if DeCriptWord( Get4Ini("PHL","LHPEP" ,"C:\RCACFG.INI")) # "SIM"
msg("PE Pharmalink não habilitado.")
return Nil
endif
VerFTP()
****************************************************************************
static function VerFTP()
****************************************************************************
private cServidor, cUsuario, cSenha
if !net_use("CONFIG")
return
endif
cServidor := alltrim(PHL_SERV)
cUsuario := alltrim(PHL_USU)
cSenha := alltrim(PHL_SENHA)
oInternet := TInternet():New()
oFTP := TFTP():New( cServidor, oInternet, cUsuario, cSenha )
if oInternet:hSession # Nil
if !Empty( oFTP:hFTP )
//Abriu o Ftp
MandaArq(oFtp,oInternet)
RecebArq(oFtp,oInternet)
else
msg("Sem Acesso ao FTP.")
endif
else
msg("Sem Acesso a Internet.")
endif
oInternet:End()
oFtp:End()
close CONFIG
return Nil
****************************************************************************
static function MandaArq(oFtp,oInternet)
****************************************************************************
local nTotal, hSource, cBuffer := Space( 6400 ), nBufSize := 6400,;
oFile
cEnvOrig := "\pharmali\envio\phl.txt"
cEnvDest := "/" + cUsuario + "/envio/phl99_" + str(year(date()),4) + ;
substr(dtoc(date()),4,2) + left(dtoc(date()),2) + ;
left(strtran(time(),":"), 2) + ;
substr(strtran(time(),":"),3,2) + ;
substr(strtran(time(),":"),5,2) + ".txt"
hSource := FOpen( cEnvOrig )
if !file(cEnvOrig)
msg("Arquivo para envio não existe.")
return Nil
endif
barra("Enviando arquivo " + cEnvOrig + " para " + cEnvDest + "...")
cBuffer := Space( 6400 )
nBufSize := 6400
SysRefresh()
msg(cEnvDest)
oFile := TFtpFile():New( cEnvDest, oFTP )
if Empty(oFile)
msg("Erro na criação do arquivo no FTP.")
return Nil
endif
oFile:OpenWrite()
FSeek( hSource, 0, 0 )
nTotal := 0
while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0
nFeito := oFile:Write( SubStr( cBuffer, 1, nBytes ) )
barra("Enviando arquivo " + cEnvOrig + " para " + cEnvDest + " -> " + alltrim(str(nBufSize)) + "...")
SysRefresh()
nTotal += nBufSize
end
oFile:End()
FClose( hSource )
msg("Arquivo com " + transform(nTotal,"9,999,999,999") + " Bites enviado com sucesso...")
barra("")
ferase(cEnvOrig)
return Nil
****************************************************************************
static function RecebArq(oFtp,oInternet)
****************************************************************************
local nX, hTarget, cBuffer := Space( 6400 ), nBufSize := 6400 ,;
aVerFiles, nSeconds, nFeito := 0, cArqRec, cArqEnv, lErro, nTot,;
nArq := 1
aVerFiles := oFTP:Directory("/" + cUsuario + "/Retorno/*.RET" )
aVerFiles := ASort(aVerFiles,,,{|x,y| x[1] < y[1]})
barra("Recebendo arquivo de retorno...")
For nX := 1 To Len(aVerFiles)
cArqEnv := "/" + cUsuario + "/Retorno/" + aVerFiles[nX][1]
do while .t.
cArqRec := "\PHARMALI\RETORNO\PHL" + strzero(nArq,5) + ".RET"
if file(cArqRec)
nArq++
loop
endif
exit
enddo
cBuffer := Space( 6400 )
nBufSize := 6400
//---- Recebe o arquivo do FTP ----//
hTarget := FCreate( cArqRec )
oFile := TFtpFile():New( cArqEnv, oFTP )
If oFile # Nil
oFile:OpenRead()
nSeconds := Seconds()+600
nTot := 0
lErro := .F.
while ( nBytes := Len( cBuffer := oFile:Read( nBufSize ) ) ) > 0
FWrite( hTarget, cBuffer, nBytes )
SysRefresh()
nTot += nBytes
If Seconds() > nSeconds
lErro := .T.
Endif
end
FClose( hTarget )
oFile:End()
if !lErro
if nTot = 0
loop
endif
msg("Recebidos " + transform(nTot,"9,999,999,999") + " Bytes.")
FClose( hTarget )
//---- Elimina do Diretório do FTP ----//
oFtp:DeleteFile( cArqEnv )
++nFeito
else
msg("Erro lendo arquivo " + cArqEnv + ".")
return Nil
endif
else
msg("Não foi possÃvel abrir o arquivo " + cArqEnv + ".")
return Nil
endif
Next
if nFeito == 0
msg("Não houve arquivo para receber.")
endif
barra()
Return Nil
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
Editado por - rmarra on 29/06/2011 10:18:04
-
Obrigado Geovanni, vou testar!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
É porque o cliente usa proxy na sua rede.
Precisaria passar o Login, Senha, IP e porta para liberação para acesso a internet.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Senhores, a classe funciona perfeita, porém tem esta questão do proxy.
Será que realmente não tem como ajustar para funcionar com proxy?
Obrigado!!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Olá Marcelo, tb. estou começando a ver agora.
No exemplo abaixo, ele me retorna o conteúdo xml.
Meu problema é usar com proxy por ainda ser 16 bits.
Ex:
ws:=TdWebService():new()
msgalert(ws:OpenWS('http://www.medifacil.com.br/httpservice.php?servico=1&usuario=3245&senha=cb0f889221cccf709f727cac52c27f8c&beneficiario=MG-0000-000000'))
Assim que evoluir posto demais exemplos.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Bom dia Vailton! é que para este sistema que preciso ainda é em 16 bits. Tem alguma solução?
Obrigado!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Boa noite a todos..
Senhores, eu baixei da parte de dicas na pagina principal do site uma classe que faz uso de webservice, e por sinal funciona muito bem.
http://www.fivewin.com.br/exibedicas.asp?id=480
Mas gostaria de usar com proxy, é possivel?
Se sim, poderiam compartilhar?
Antecipadamente agradeço.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Boa noite a todos..
Senhores, eu baixei da parte de dicas na pagina principal do site uma classe que faz uso de webservice, e por sinal funciona muito bem.
http://www.fivewin.com.br/exibedicas.asp?id=480
Mas gostaria de usar com proxy, é possivel?
Se sim, poderiam compartilhar?
Antecipadamente agradeço.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
O problema que o erro ocorre antes do sistema subir!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Obrigado!!!
Fiz um teste básico e aparentemente deu certo!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Não entendi bem como fazer a função time() funcionar corretamente no fw.
Preciso que funcione sem telas, janelas, barras, etc.
Vc poderia simplificar para mim?
Grato.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
Editado por - rmarra on 29/09/2009 08:51:51
-
Prezados, alguém já descobriu como pegar a hora atual no XP?
Ex: Entro no sistema as 16:00h, mudo a hora do computador para 17:30h, uso a função time() para pegar a hora atual e continua a anterior. Só passa a pegar a correta se sair do sistema e entrar novamente.
Preciso muito que isto funcione em FW 16 bits.
Obrigado!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Prezados, alguém já descobriu como pegar a hora atual no XP?
Ex: Entro no sistema as 16:00h, mudo a hora do computador para 17:30h, uso a função time() para pegar a hora atual e continua a anterior. Só passa a pegar a correta se sair do sistema e entrar novamente.
Preciso muito que isto funcione em FW 16 bits.
Obrigado!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Prezados, alguém já descobriu como pegar a hora atual no XP?
Ex: Entro no sistema as 16:00h, mudo a hora do computador para 17:30h, uso a função time() para pegar a hora atual e continua a anterior. Só passa a pegar a correta se sair do sistema e entrar novamente.
Preciso muito que isto funcione em FW 16 bits.
Obrigado!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
Editado por - rmarra on 28/09/2009 17:46:52
-
Obrigado fluna, acho que é algo por aà mesmo. Sei que vai dar trabalho, mas com o PAF temos que ter a opção do servidor cair continuar fazendo venda localmente.
Um abraço!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Ok, vou dar uma futucada!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Kapi, como é a sintaxe de uso deste comando WNETADDCON()?
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Kapi, deveria ser assim:
- Fazendo venda normal pela rede atualizando no banco de dados do servidor.
- A rede caiu, mas as estações devem continuar vendendo e imprimindo a venda localmente.
- Rede voltou, atualizar os dados das vendas locais das estações no banco de dados do servidor
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Olá pessoal, gostaria de pedir uma dica.
Preciso colocar meu sistema para caso o servidor da rede local caia, os terminais continuem fazendo venda e quando a rede voltar, atualizar as informações no servidor.
Parece-me que existe uma rotina usando FTP local para replicar as informações dando segurança, evitando uma possÃvel copia de arquivos de uma estação para outra ocasionando sérios transtornos.
OBS:
1- O banco de dados ainda é DBF/CDX.
2- Este sistema é em FW 16 Bits
Ficarei muito grato com alguma ajuda.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Olá pessoal, gostaria de pedir uma dica.
Preciso colocar meu sistema para caso o servidor da rede local caia, os terminais continuem fazendo venda e quando a rede voltar, atualizar as informações no servidor.
Parece-me que existe uma rotina usando FTP local para replicar as informações dando segurança, evitando uma possÃvel copia de arquivos de uma estação para outra ocasionando sérios transtornos.
OBS:
1- O banco de dados ainda é DBF/CDX.
2- Este sistema é em FW 16 Bits
Ficarei muito grato com alguma ajuda.
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
-
Coloquei para só criar o arquivo grande já no FTP ao invez de cria-lo grande e enviar e deu certo.
Obrigado!!!
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop
Classe TdWebService
in Programação
Posted
Estou usando esta classe para fazer conexão webservice.
Porém preciso utiliza-la tb. para quem tem proxy.
Alguém poderia ajudar de como proceder?
Desde já agradeço!
CLASS TdWebService
DATA hOpen
DATA sbuffer HIDDEN
DATA xDLL HIDDEN
METHOD New(buffersize) CONSTRUCTOR
METHOD OpenWS(url)
METHOD End()
ENDCLASS
*****************************
METHOD New(conexion,buffersize) CLASS TdWebService
DEFAULT buffersize:=3200
::sbuffer:=buffersize
xDll:=LoadLib32("wininet.dll")
::hOpen = InternetOpen("TdWebService", 1,,, 0)
RETURN Self
*****************************
METHOD OpenWS(url) CLASS TdWebService
local hFile,ret,xml
hFile = InternetOpenUrl(::hOpen, url,"",0,,0)
xml:=space(::sbuffer)
InternetReadFile(hFile, @xml, ::sbuffer, @Ret)
return subst(alltrim(xml),1,len(alltrim(xml))-2)
*****************************
METHOD End() CLASS TdWebService
FreeLib32(xDll)
return nil
*****************************
DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
n4 AS DWORD ) AS LONG PASCAL ;
FROM "InternetOpenA" LIB xdll
Dll32 Function InternetReadFile(hFile As 7, @sBuffer As 8, lNumBytesToRead As 7, @lNumberOfBytesRead As 7) As 7 PASCAL Lib xdll
Dll32 Function InternetOpenUrl(hInternetSession As 7, lpszUrl As 8, lpszHeaders As 8, dwHeadersLength As 7, dwFlags As 7, dwContext As 7) As 7 FROM "InternetOpenUrlA" PASCAL Lib xdll
DLL32 FUNCTION InternetCloseHandle( hSession AS LONG ) AS BOOL PASCAL LIB xdll
Rondinelli - Itaocara-RJ
Clipper 5.3b, Fivewin 2.6, Blinker 7, WorkShop