CreateObject( "MSXML2.XMLHTTP" )

Re: CreateObject( "MSXML2.XMLHTTP" )

Postby Silvio.Falconi » Sun Jan 24, 2021 2:26 pm

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

Code: Select all  Expand view  RUN

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 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: CreateObject( "MSXML2.XMLHTTP" )

Postby Giovany Vecchi » Mon Jan 25, 2021 10:18 pm

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  Expand view  RUN

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
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: CreateObject( "MSXML2.XMLHTTP" )

Postby karinha » Wed Jan 27, 2021 2:24 pm

Funciona perfecto con HARBOUR para BCC74.

Aqui:

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=39892

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7834
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: CreateObject( "MSXML2.XMLHTTP" )

Postby Silvio.Falconi » Wed Jan 27, 2021 3:54 pm

karinha wrote:Funciona perfecto con HARBOUR para BCC74.

Aqui:

http://forums.fivetechsupport.com/viewtopic.php?f=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  Expand view  RUN

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  Expand view  RUN
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 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano, MarcoBoschi, nageswaragunupudi and 26 guests