CreateObject( "MSXML2.XMLHTTP" )

User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: CreateObject( "MSXML2.XMLHTTP" )

Post by Silvio.Falconi »

Giovany Vecchi wrote:In some versions of windows as an example: SEVEN SP1 and XP I solved the problem including SETTIMEOUTS.

Code: Select all

oServer := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
oServer:SetTimeouts(40000,40000,40000,40000)
 

Application
===========
Path and name: C:\work\prg\yunus_telegram\yunus.Exe (32 bits)
Size: 4,217,344 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 20.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.1, Build 7601 Service Pack 1

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 24-01-2021, 15:25:48
Error description: (DOS Error -2147352570) WINOLE/1009 No exported method: SETTIMEOUTS
Args:
[ 1] = N 40000
[ 2] = N 40000
[ 3] = N 40000
[ 4] = N 40000

Stack Calls
===========
Called from: => TOLEAUTO:SETTIMEOUTS( 0 )
Called from: yunus.prg => READMESSAGE( 211 )
Called from: yunus.prg => TESTTELEGRAM( 67 )
Called from: yunus.prg => MAIN( 39 )
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: CreateObject( "MSXML2.XMLHTTP" )

Post by Giovany Vecchi »

My clients haven't used Windows XP in a long time. I remember that some methods didn't work correctly, so I used the winhttp.winhttprequest.5.1 class.
Try it like this:

Code: Select all

If Os_IsWinXp()
   oServer := CreateObject( "winhttp.winhttprequest.5.1" )
Else
   oServer := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
EndIf
   oServer:SetTimeouts(40000,40000,40000,40000)
 
The class of winhttp.winhttprequest.5.1 does not have all the features of MSXML2.ServerXMLHTTP.6.0 but to perform a simple METHOD POST it works well.
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CreateObject( "MSXML2.XMLHTTP" )

Post by karinha »

Funciona perfecto con HARBOUR para BCC74.

Aqui:

http://forums.fivetechsupport.com/viewt ... =3&t=39892

Regards, saludos.
João Santos - São Paulo - Brasil
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: CreateObject( "MSXML2.XMLHTTP" )

Post by Silvio.Falconi »

karinha wrote:Funciona perfecto con HARBOUR para BCC74.

Aqui:

http://forums.fivetechsupport.com/viewt ... =3&t=39892

Regards, saludos.

do you tried it on a machine having windows Seven Home?

Please don't keep insisting, I tested also on the following Computer

Asus Rog G73 jw 16GBRAM with Windows Seven Home 64 bit

NOT RUN

make the same errors



Please test this test.prg

Code: Select all

function ReadMessage()
   local HData,cr
   local odoc  := CreateObject( "MSXML2.DOMDocument" )
   local   cTOKEN:="1206646388:AAEr-QL8hSYNAJ3dNx2k6w7u0nEAOWld2Po"
   local URL:="https://api.telegram.org/bot"+cTOKEN+"/getUpdates"


    If Os_IsWinXp()
  ohttp := CreateObject( "winhttp.winhttprequest.5.1" )
Else
   ohttp := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
EndIf
   ohttp:SetTimeouts(40000,40000,40000,40000)


   ohttp:Open( "POST" ,URL, .F. )
    oHttp:SetRequestHeader("Accept" ,"application/xml")
   oHttp:SetRequestHeader("Content-Type","application/json")
   oDoc:async:=.f.
   oDoc:LoadXml('<?xml version=""1.0"" encoding=""utf-8""?>')
   oHttp:Send(oDoc:xml)

 if oHttp:status==200
        cR:=Alltrim(oHttp:responseText)
        cR:= StrTran(Cr,'"ok":true,','')
        HData:=strtoHasharray(cr)
        xbrowser HData
    
endif
return nil

I have this error

Code: Select all

Application
===========
   Path and name: C:\work\prg\yunus_telegram\yunus.Exe (32 bits)
   Size: 4,217,856 bytes
   Compiler version: Harbour 3.2.0dev (r1904111533)
   FiveWin  version: FWH 20.12
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 31-01-2021, 11:18:02
   Error description: (DOS Error -2147352567) WINOLE/1007  Errore nel supporto per il canale di protezione
 (0x80072F7D): msxml6.dll
   Args:
     [   1] = C   

Stack Calls
===========
   Called from:  => TOLEAUTO:SEND( 0 )
   Called from: yunus.prg => READMESSAGE( 226 )
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply