Wednesday, August 17, 2011

XigniteMetalsSoapClient

using RemoteMetals = NopSolutions.NopCommerce.Web.xMetalService;

private xMetalService.XigniteMetalsSoapClient proxy;

proxy = new xMetalService.XigniteMetalsSoapClient("XigniteMetalsSoap");
RemoteMetals.Header header = new RemoteMetals.Header();
header.Username = "xxxxx";
header.Password = "yyyyy";
RemoteMetals.LondonFixing objLondonFixing = proxy.GetLastLondonFixing(header, RemoteMetals.FixingTypes.LondonGold, RemoteMetals.FixingCurrencyTypes.USD);

chart = proxy.GetLondonFixingChart(header, RemoteMetals.FixingTypes.LondonGold, RemoteMetals.PeriodType.Morning, RemoteMetals.FixingCurrencyTypes.USD, "8/15/2010", "8/15/2011", RemoteMetals.StockChartStyles.Line, 600, 400);

if (objLondonFixing == null)
{
/// add error processing here
/// this condition could be caused by an HTTP error (404,500...)
Response.Write("Service is unavailable at this time.");
}
else
{
switch (objLondonFixing.Outcome)
{
case RemoteMetals.OutcomeTypes.Success:
/// add processing for displaying the results, e.g.
/// display the value for Value
/// other values could be consumed in the same manner
Response.Write(objLondonFixing.Value);
Response.Write(chart.Url);
break;
default:
/// add processing for handling request problems, e.g.
/// you could pass back the info message received from the service
Response.Write(objLondonFixing.Message);
break;
}
}

No comments: