Calling the FoxCentral Service

The Fox Central service is easy to call.

MSSOAP client:

oProxy = CREATEOBJECT("MSSOAP.SoapClient") oProxy.MSSoapInit("http://www.foxcentral.net/foxcentral.wsdl") *** Get news for all providers and all types lcXML = oProxy.GetItems(DATE(),0,0,"ALL") && Parm 2 is timezone... IF !EMPTY(lcXML) XMLTOCURSOR(lcXML,"xnews",0) BROWSE ENDIF lcXML = oProxy.GetProviders() IF !EMPTY(lcXML) XMLTOCURSOR(lcXML,"xproviders",0) BROWSE ENDIF lcSubject = INPUTBOX("Enter Subject","FoxNews") IF EMPTY(lcSubject) RETURN ENDIF lcContent = INPUTBOX("Enter Content","FoxNews") *** Add a new item - .T. or .F. result ? oProxy.AddNewsItem(lcSubject,lcContent,"http://www.microsoft.com/vfoxpro/",DATETIME(),2,"ms")

.Net client:
Add a Web Reference to your project and point it at:
http://www.foxcentral.net/foxcentral.wsdl

Add:

using YourProject.foxcentral;

to the top of any module that will host the Web service. The following example demonstrates how to pull the NewsItem list into a data set which you can use in your .Net client application:

/// ASP.Net page that displays output private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here foxcentral loNews = new foxcentral(); string lcXML = ""; System.Data.DataSet oDS = new DataSet(); bool lbError = false; try { /// Retrieve news for the last 5 days for all providers and all types lcXML = loNews.GetItems(System.DateTime.Today.Subtract(TimeSpan.FromDays(5)),0,0,"ALL"); } catch( Exception ex) { lcXML = "No news items to retrieve..."; } //lblContent.Text = "<PRE>" + lcXML + "</PRE>"; try { /// *** Read into the data set oDS.ReadXml(new StringReader(lcXML)); } catch(Exception ex) { lblContent.Text = ex.ToString(); lbError = true; } if (!lbError) { oRepeater.DataSource = oDS.Tables[0].DefaultView; oRepeater.DataBind(); } }


  Last Updated: 6/3/2007 | © West Wind Technologies, 2007