* _tipocot = 2225 = DOLAR USA BILLETE
* 9800 = UI
* 9900 = UR
********************* && COTIZACION DEL DOLAR BCU POR WS
FUNCTION CotizBCU_XML(_fecha,_filetxt,_tipocot)
LOCAL _ws, _url, _soapaction
LOCAL cResp, cxml:=""
LOCAL _desdehasta
LOCAL oClient
DEFAULT _filetxt TO _pathtemp+"\CotBCU_"+DTOS(DATE())+".TXT",;
_fecha TO DATE()-1,;
_tipocot TO "2225"
_desdehasta:= TRANSFORM(YEAR(_fecha),"9999")+"-"+STRTRAN(TRANSFORM(MONTH(_fecha),"99")," ","0")+"-"+STRTRAN(TRANSFORM(DAY(_fecha),"99")," ","0")
_ws := "awsbcucotizaciones"
_url := "
https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/"
_soapAction:= "Cotizaaction/AWSBCUCOTIZACIONES.Execute"
cxml := '<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:cot="Cotiza">'
cxml += "<soapenv:Header/>"
cxml += "<soapenv:Body>"
cxml += "<cot:wsbcucotizaciones.Execute>"
cxml += "<cot:Entrada>"
cxml += "<cot:Moneda>"
cxml += "<cot:item>"+_tipocot+"</cot:item>"
cxml += "</cot:Moneda>"
cxml += "<cot:FechaDesde>"+_desdehasta+"</cot:FechaDesde>"
cxml += "<cot:FechaHasta>"+_desdehasta+"</cot:FechaHasta>"
cxml += "<cot:Grupo>2</cot:Grupo>"
cxml += "</cot:Entrada>"
cxml += "</cot:wsbcucotizaciones.Execute>"
cxml += "</soapenv:Body>"
cxml += "</soapenv:Envelope>"
oClient := TIpClientHttp():New( _url+_ws /* log ,T. */ )
IF !oClient:open()
hb_gtAlert( "Imposible conectar con BCU"+HB_EOL()+HB_EOL()+oClient:lastErrorMessage(), {"Ok."} , , , 10 )
RETURN(.F.)
ENDIF
oClient:Post( cxml )
cResp := S_GETTAG("TCV",oClient:read())
oClient:close()
_cotiz:=ALLTRIM(cResp)
IF VAL(_cotiz)#0
hb_MEMOWRIT(_filetxt,_cotiz) && Se escribe el archivo con el valor de la cotizacion
ENDIF
RETURN(VAL(_cotiz))