Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2007, 05:21 AM
Friend of Wrox
 
Join Date: May 2006
Location: Northampton, United Kingdom.
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default SOAP and Betfair API


Can you help please?


I am learning to use SOAP and I have been starting out by trying to access the Betfair API.


So far I have managed to log in successfully but I am now stuck


I have seen a sample program on the betfair site but it's written in C# (See below)


Has anyone converted this code to VB if so can you post some of the code?
For instance how do I go about calling GetEventsReq and display the information on a datagrid?


I'm sure that once I can understand how to run one option I can relate the lessons learnt to all other options.


I'd be very grateful for any assistance.



Thanks




/////////////////////////////////////////////////////////////////////////////////
// Load Today's Card (horses)
GetEventsReq eventsReq = new GetEventsReq();
eventsReq.header = new APIRequestHeader();
eventsReq.header.sessionToken = sessionToken;
eventsReq.eventParentId = 13;
GetEventsResp eventsResp = service.getEvents(eventsReq);
sessionToken = eventsResp.header.sessionToken;
/////////////////////////////////////////////////////////////////////////////////
// Display total number of markets, and select one randomly to load
int numberOfMarkets = eventsResp.marketItems.Length;
Console.WriteLine("{0} markets in Today's Card", numberOfMarkets);
Random rand = new Random();
MarketSummary marketSummary = eventsResp.marketItems[rand.Next(numberOfMarkets)];
/////////////////////////////////////////////////////////////////////////////////
// Get market
GetMarketReq marketReq = new GetMarketReq();
marketReq.header = new APIRequestHeader();
marketReq.header.sessionToken = sessionToken;
marketReq.marketId = marketSummary.marketId;
GetMarketResp marketResp = service.getMarket(marketReq);
sessionToken = marketReq.header.sessionToken;
/////////////////////////////////////////////////////////////////////////////////
// Get market prices
GetMarketPricesReq marketPricesReq = new GetMarketPricesReq();
marketPricesReq.header = new APIRequestHeader();
marketPricesReq.header.sessionToken = sessionToken;
marketPricesReq.marketId = marketSummary.marketId;
GetMarketPricesResp marketPricesResp = service.getMarketPrices(marketPricesReq);
sessionToken = marketPricesResp.header.sessionToken;
/////////////////////////////////////////////////////////////////////////////////
// Display market
Console.WriteLine("{0:HH:mm} {1}", marketResp.market.marketDisplayTime, marketResp.market.name);
if (marketResp.market.runners == null || marketPricesResp.marketPrices.runnerPrices == null)
{
Console.WriteLine(marketResp.market.marketStatus.T oString());
}
else
{
for (int i = 0; i < marketResp.market.runners.Length; i++)
{
Console.WriteLine("{0} {1}", marketResp.market.runners[i].name.PadRight(30),
marketPricesResp.marketPrices.runnerPrices[i].bestPricesToBack[0].price);
}

__________________
Try our latest project www.nobanx.com Currency Exchange for members




Similar Threads
Thread Thread Starter Forum Replies Last Post
What is SOAP why do we need it nidhimittal Pro PHP 1 October 23rd, 2006 03:28 AM
soap on C shiji4u XML 0 March 1st, 2006 04:59 AM
Using SOAP and C++ RussellThor Visual C++ 0 November 29th, 2005 09:06 PM
API SOAP request harpua PHP How-To 0 September 13th, 2005 10:21 AM
soap a.slaughter Pro PHP 0 March 22nd, 2005 10:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.