LPARAMETERS method_name, menoxml, pripravene
PRIVATE m.crlf, m.XML_XMLDOM_PROGID, m.XML_SCHEMA_MEMOSIZE, m.WWXML_USE_VFP_XMLTOCURSOR, oerr, stav, pokusy, m.ret
m.ret=.f.
m.pokusy=0
SYS(3101, 65001)
input_cursor_name="__wwXMLCust"
m.request=tvorxml(m.menoxml, m.pripravene)
DO WHILE .t.
	m.stav=ACT("ctvs."+m.method_name+"(apikey,'"+STRTRAN(m.request,CHR(13)+CHR(10),"")+"').encode('utf_8')$$40")
*!*		m.stav=ACT("ctvs."+m.method_name+"(apikey,'"+STRTRAN(m.request,CHR(13)+CHR(10),"")+"')$$10")
	DO CASE 
		CASE EMPTY(m.stav)
			m.pokusy=m.pokusy+1
		CASE VARTYPE(m.stav)="N" AND m.stav=0
			m.ret=.t.
			EXIT 
		CASE VARTYPE(m.stav)="C" AND LEFT(m.stav,2)="0;"
			m.ret=.t.
			EXIT 
		OTHERWISE 
*!*			CASE VARTYPE(m.stav)="C" AND "timed out"$m.stav
			WAIT "Prebieha komunikácia: "+ALLTRIM(STR(m.pokusy,2,0)) WINDOW TIMEOUT 1
			m.pokusy=m.pokusy+1
	ENDCASE 
	IF m.pokusy>5
		EXIT
	ENDIF 
ENDDO 
IF USED("__wwxmlcust")
	USE IN __wwxmlcust
ENDIF 
IF m.ret
	ERASE (m.xml_export_path+m.menoxml)
ENDIF 
RETURN m.ret 		
