LPARAMETERS method_name, menocursora, ukoncene, uzaverka
PRIVATE m.crlf, m.XML_XMLDOM_PROGID, m.XML_SCHEMA_MEMOSIZE, m.WWXML_USE_VFP_XMLTOCURSOR, oerr, stav, m.xmltext, ret, m.pokusy, ajuz
m.ajuz=(PARAMETERS()=4)
SYS(3101, 65001)
input_cursor_name="__wwXMLCust"
XML_XMLDOM_PROGID="msxml2.domdocument"
XML_SCHEMA_MEMOSIZE=2147483647
WWXML_USE_VFP_XMLTOCURSOR=.F.

SET CLASSLIB TO wwXML ADDITIVE
SET PROCEDURE TO wwutils ADDITIVE 
SYS(3101, 1250)

CRLF=CHR(10)+CHR(13)
mXML = CREATE("wwXML")
m.pokusy=0
m.ret=.f.
DO WHILE m.pokusy<5
	IF m.ajuz
		m.xmltext=ACT("ctvs."+m.method_name+"(apikey,"+IIF(m.ukoncene,'True','False')+",'"+m.uzaverka+"').encode('utf-8')$$99")
	ELSE
		m.xmltext=ACT("ctvs."+m.method_name+"(apikey,"+IIF(m.ukoncene,'True','False')+").encode('utf-8')$$99")
	ENDIF 
	IF !EMPTY(m.xmltext)
		m.stav=mXML.XMLTOCURSOR(m.xmltext,m.menocursora)
		IF m.stav AND USED(m.menocursora)
			ret=.t.
			EXIT 
		ELSE
			m.pokusy=m.pokusy+1
		ENDIF 
	ELSE 
		m.pokusy=m.pokusy+1
	ENDIF 
ENDDO 
RELEASE CLASSLIB wwxml
RELEASE PROCEDURE wwutils 
RETURN m.ret
