El primer paso es agregar la referencia web al proyecto en Visual. En este caso específico es: http://obiee.banrep.gov.co/analytics/saw.dll?wsdl
Luego viene el código para leer el reporte específico:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Data.SqlClient;
using System.Configuration;
using TRM_BanRep.banrep;
using System.Data;
namespace TRM_BanRep
{
class Program
{
///
/// Based on Obiee Web Services – Using .net and C# post on http://tipsonobiee.blogspot.com/2009/07/obiee-web-services-using-net-and-c.html
///
///
static void Main(string[] args)
{
//Open SAW session in OracleBI - Banco de la Republica
SAWSessionServiceSoapClient sawSession = new SAWSessionServiceSoapClient();
string sessionID = sawSession.logon("publico", "publico");
//Set report parameters
ReportRef repRef = new ReportRef();
//path: get from report http url
repRef.reportPath = @"/shared/Consulta Series Estadisticas desde Excel/1. Tasa de Cambio Peso Colombiano"
+ "/1.1 TRM - Disponible desde el 27 de noviembre de 1991/TRM para un dia";
//xml: get from report http url + &format=xml
repRef.reportXml = ""
+ ""
+ ""
+ " ";
//Create xml view, set xml options
XmlViewServiceSoapClient xmlView = new XmlViewServiceSoapClient();
XMLQueryExecutionOptions xmlOpts = new XMLQueryExecutionOptions();
xmlOpts.maxRowsPerPage = 100;
xmlOpts.refresh = true;
//Pass report parameters
ReportParams repParams = new ReportParams();
//Execute XML Query
QueryResults qResults = xmlView.executeXMLQuery(repRef, XMLQueryOutputFormat.SAWRowsetData, xmlOpts, repParams, sessionID);
//Print rowset
sawSession.logoff(sessionID);
//Get rate value from result XML
XmlDocument results = new XmlDocument();
results.LoadXml(qResults.rowset);
DateTime trmDate = DateTime.Today.AddDays(-5);
XmlNodeList xnlDate = results.GetElementsByTagName("Column0");
foreach (XmlNode xn in xnlDate)
trmDate = DateTime.ParseExact(xn.InnerText, "dddd d 'de' MMMM 'de' yyyy", CultureInfo.CreateSpecificCulture("es-CO"));
decimal trm = decimal.Zero;
XmlNodeList xnlRate = results.GetElementsByTagName("Column2");
foreach (XmlNode xn in xnlRate)
trm = Convert.ToDecimal(xn.InnerText, CultureInfo.InvariantCulture);
}
}
}
Nota: La URL del reporte mencionada en los comentarios se obtiene del código fuente de la página.