Page 1 of 1

error on createobject

Posted: Sat Jan 16, 2021 12:11 pm
by Silvio.Falconi
function ReadMessage()
local HData,cr
local odoc := CreateObject( "MSXML2.DOMDocument" )
local ohttp := CreateObject( "MSXML2.XMLHTTP" )
local cTOKEN:="1206646388:AAEr-QL8hSYNAJ3dNx2k6w7u0nEAOWld2Po"
local URL:="https://api.telegram.org/bot"+cTOKEN+"/getUpdates"

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
....
endif
return nil


give me error on bold line

the error

Code: Select all

Application
===========
   Path and name: C:\Work\Errori\Telegram_forum\test2.Exe (32 bits)
   Size: 4,013,568 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 7600 

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 01/16/21, 12:58:06
   Error description: (DOS Error -2147352567) WINOLE/1007  Download della risorsa specificata non riuscito.
 (0x800C0008): msxml3.dll
   Args:
     [   1] = C   

Stack Calls
===========
   Called from:  => TOLEAUTO:SEND( 0 )
   Called from: test2.prg => READMESSAGE( 104 )
 

Re: error on createobject

Posted: Mon Jan 18, 2021 7:38 am
by AntoninoP
I am not sure it is the error, but on header you send Content-type equals application/json then send an xml.
Why you load an xml inside a document then send the xml properties instead of send your xml directly?
The xml is only

Code: Select all

<?xml version=""1.0"" encoding=""utf-8""?>"
?

Re: error on createobject

Posted: Mon Jan 18, 2021 7:45 am
by Silvio.Falconi
AntoninoP wrote:I am not sure it is the error, but on header you send Content-type equals application/json then send an xml.
Why you load an xml inside a document then send the xml properties instead of send your xml directly?
The xml is only

Code: Select all

<?xml version=""1.0"" encoding=""utf-8""?>"
?
on win 10 run ok