Lim Cheng Lei                       Microsoft Student Partners SingaporeData and Services Marketplace for Innovators
What is Project Nimbus?
Datasets Available            Cinema Online  Project   Hungry Go Where  Nimbus    Land Transport Authority            Nati...
Behind Project Nimbus Architecture  Existing    Data Service            Deliver to  Service      in Project             En...
Project Nimbus Architecture                                            Applications used by                   Data service...
Project Nimbus Architecture                 Data information from Content Providers   Web Service – http://api.projectnimb...
Sample Application Architecture                                                  Cinema                                   ...
Getting Started
3 Steps to Use  Get access to   Call the Web               Start Project Nimbus      Service               Developing     ...
Get access to ProjectNimbus              Project Nimbus Credentials
How do I get access?• Email us: projectnimbus@live.com.sg  – Account Key    [Request from Project Nimbus]  – Unique User I...
Call the Web Service             Project Nimbus Data Service
Querying Data Service  • http://api.projectnimbus.org/tool.aspx       – http://api.projectnimbus.org/coodataservice.svc/Mo...
Start Developing              Mesh with Project Nimbus
Mesh the data servicesInnovate Applications
Getting Started with C#
Calling the Web Service Ipublic List<MovieEntry> GetMovieFromNimbusCO(){   WebRequest wr =   HttpWebRequest.Create("http:/...
Calling the Web Service IIList<MovieEntry> results =    (from item in XElement.Parse(resStr).Descendants(atomNS + "entry")...
What are proxy classes?• Individual class files for each datasets of the  data services• Easier for developers to call the...
Why should I use proxy classes?• Simplifies coding process• .NET to process all the consummation of data  back end• 5 line...
How can I use it?• ADO.NET Data Services v1.5 CTP2• Add Reference > Browse Tab > C:Program  FilesADO.NET Data Services V1....
Calling the Web Service I (Using LINQ)protected void Page_Load(object sender, EventArgs e){    SNBModel.SNBEntities snbEnt...
Calling the Web Service II (Using LINQ)protected void Page_Load(object sender, EventArgs e){   SNBModel.SNBEntities snbEnt...
Getting Started with Silverlight
Why Silverlight?
What do I need?• ADO.NET Data Services for Silverlight 3 CTP 3• Add Reference > Browse Tab > C:Program  FilesADO.NET Data ...
Calling the Web Service IDataServiceCollection<SNBModel.ATM> atms;public MainPage(){   InitializeComponent();   SNBModel.S...
Calling the Web Service IIprivate void OnATMSQueryComplete(IAsyncResult result){    // Use the Dispatcher to ensure that t...
Calling the Web Service III             foreach (var atm in (query.EndExecute(result)))             {                 retu...
Getting Started with Java
Parsing the Atom Feedpublic static String getStringBetween(String src, String start, String end) {    StringBuilder sb = n...
Calling the Web Service Ipublic ArrayList<ATM> getATMS() {   atmList = new ArrayList<ATM>();   try {       URL _url = new ...
Calling the Web Service II        String line = null;        StringBuilder strBuilder = new StringBuilder();        while ...
Calling the Web Service III    String[] IProperties = strBuilder.toString().split("<m:properties>");        for (String st...
www.projectnimbus.org
innovativesingapore.comtwitter.com/innovativesg
Project Nimbus
Upcoming SlideShare
Loading in...5
×

Project Nimbus

406

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
406
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Project Nimbus

  1. 1. Lim Cheng Lei Microsoft Student Partners SingaporeData and Services Marketplace for Innovators
  2. 2. What is Project Nimbus?
  3. 3. Datasets Available Cinema Online Project Hungry Go Where Nimbus Land Transport Authority National Library Board National Environment Agency Singapore Tourism Board Sing Post Show Near By Urban Redevelopment Authority
  4. 4. Behind Project Nimbus Architecture Existing Data Service Deliver to Service in Project End Users Nimbus Easy access to data services
  5. 5. Project Nimbus Architecture Applications used by Data services built inExisting Service End Users Project Nimbus (Consumers)
  6. 6. Project Nimbus Architecture Data information from Content Providers Web Service – http://api.projectnimbus.org/yourodataservice.svc/
  7. 7. Sample Application Architecture Cinema Hungry Online Go Where http://api.projectnimbus.org/ Show yourodataservice.svc/ Near By http://<yourapp>.com
  8. 8. Getting Started
  9. 9. 3 Steps to Use Get access to Call the Web Start Project Nimbus Service Developing Developing on Project Nimbus
  10. 10. Get access to ProjectNimbus Project Nimbus Credentials
  11. 11. How do I get access?• Email us: projectnimbus@live.com.sg – Account Key [Request from Project Nimbus] – Unique User ID [Generate your own 32 characters GUID] eg. 00000000000000000000000000000001
  12. 12. Call the Web Service Project Nimbus Data Service
  13. 13. Querying Data Service • http://api.projectnimbus.org/tool.aspx – http://api.projectnimbus.org/coodataservice.svc/MovieSet – http://api.projectnimbus.org/snbodataservice.svc/ATMSethttp://api.projectnimbus.org/coodataservice.svc/ XML Data of available properties (ODATA Format) $metadata
  14. 14. Start Developing Mesh with Project Nimbus
  15. 15. Mesh the data servicesInnovate Applications
  16. 16. Getting Started with C#
  17. 17. Calling the Web Service Ipublic List<MovieEntry> GetMovieFromNimbusCO(){ WebRequest wr = HttpWebRequest.Create("http://api.projectnimbus.org/coodataservice.svc/MovieSet?"); wr.Headers.Add("AccountKey", "YourAccountKeyHere"); wr.Headers.Add("UniqueUserID", Guid.NewGuid().ToString()); wr.Method = "GET"; WebResponse res = wr.GetResponse(); string resStr = new System.IO.StreamReader(res.GetResponseStream()).ReadToEnd(); XNamespace atomNS = "http://www.w3.org/2005/Atom"; XNamespace dNS = "http://schemas.microsoft.com/ado/2007/08/dataservices"; XNamespace mNS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
  18. 18. Calling the Web Service IIList<MovieEntry> results = (from item in XElement.Parse(resStr).Descendants(atomNS + "entry") let movie = item.Element(atomNS + "content").Element(mNS +"properties") select new MovieEntry() { MovieID = movie.Element(dNS +"MovieID").Value, Name = movie.Element(dNS +"Name").Value, ReleaseDate = movie.Element(dNS + "ReleaseDate").Value, Classification = movie.Element(dNS + "Classification").Value }).ToList(); return results; }
  19. 19. What are proxy classes?• Individual class files for each datasets of the data services• Easier for developers to call the datasets from the data services without much effort• Pre-generated proxy classes – Developers do not need to code anything
  20. 20. Why should I use proxy classes?• Simplifies coding process• .NET to process all the consummation of data back end• 5 lines of code – Able to select specific data to display• Using LINQ to query data services
  21. 21. How can I use it?• ADO.NET Data Services v1.5 CTP2• Add Reference > Browse Tab > C:Program FilesADO.NET Data Services V1.5 CTP2binMicrosoft.Data.Services.Client.dll• Import in the relevant *Proxy.cs class file into your project (For example, SNBProxy.cs)
  22. 22. Calling the Web Service I (Using LINQ)protected void Page_Load(object sender, EventArgs e){ SNBModel.SNBEntities snbEntities = new SNBModel.SNBEntities(new Uri("http://api.projectnimbus.org/snbodataservice.svc/")); snbEntities.SendingRequest += ModifyRequest; GridView1.AutoGenerateColumns = true; GridView1.DataSource = snbEntities.ATMSet.ToArray(); GridView1.DataBind();}private static void ModifyRequest(object sender, SendingRequestEventArgs e){ e.Request.Headers.Add("AccountKey", “YourAccountKeyHere"); e.Request.Headers.Add("UniqueUserID", Guid.NewGuid().ToString());}
  23. 23. Calling the Web Service II (Using LINQ)protected void Page_Load(object sender, EventArgs e){ SNBModel.SNBEntities snbEntities = new SNBModel.SNBEntities(new Uri("http://api.projectnimbus.org/snbodataservice.svc/")); snbEntities.SendingRequest += ModifyRequest; GridView1.AutoGenerateColumns = true; GridView1.DataSource = snbEntities.ATMSet.ToArray(); GridView1.DataSource = (from c in snbEntities.ATMSet select new { c.Name, c.Latitude, c.Longitude }).ToArray(); GridView1.DataBind();}
  24. 24. Getting Started with Silverlight
  25. 25. Why Silverlight?
  26. 26. What do I need?• ADO.NET Data Services for Silverlight 3 CTP 3• Add Reference > Browse Tab > C:Program FilesADO.NET Data Services for Silverlight 3 CTP 3System.Data.Services.Client.dll
  27. 27. Calling the Web Service IDataServiceCollection<SNBModel.ATM> atms;public MainPage(){ InitializeComponent(); SNBModel.SNBEntities snbEntities = new SNBModel.SNBEntities (new Uri("http://api.projectnimbus.org/snbodataservice.svc/")); snbEntities.SendingRequest += ModifyRequest; DataServiceQuery<SNBModel.ATM> query = snbEntities.ATMSet; try { // Begin the query execution. query.BeginExecute(OnATMSQueryComplete, query); }
  28. 28. Calling the Web Service IIprivate void OnATMSQueryComplete(IAsyncResult result){ // Use the Dispatcher to ensure that the asynchronous call returns in the correct thread. Dispatcher.BeginInvoke(() => { // Get the original query back from the result. DataServiceQuery<SNBModel.ATM> query = result.AsyncState as DataServiceQuery<SNBModel.ATM>; try { List<SNBModel.ATM> returnedATMs = new List<SNBModel.ATM>(); …
  29. 29. Calling the Web Service III foreach (var atm in (query.EndExecute(result))) { returnedATMs.Add(atm); } if (returnedATMs != null) { DataGrid1.ItemsSource = returnedATMs; DataGrid1.DataContext = returnedATMs; DataGrid1.UpdateLayout(); } } catch(DataServiceQueryException) { } });}
  30. 30. Getting Started with Java
  31. 31. Parsing the Atom Feedpublic static String getStringBetween(String src, String start, String end) { StringBuilder sb = new StringBuilder(); int startIdx = src.indexOf(start) + start.length(); int endIdx = src.indexOf(end); while(startIdx < endIdx){ sb.append(“” + String.valueOf(src.charAt(startIdx))); startIdx++; } return sb.toString();}
  32. 32. Calling the Web Service Ipublic ArrayList<ATM> getATMS() { atmList = new ArrayList<ATM>(); try { URL _url = new URL(“http://api.projectnimbus.org/snbodataservice.svc/ATMSet?”); URLConnection _urlConn = _url.openConnection(); _urlConn.setRequestProperty(“accept”, “*/*”); _urlConn.addRequestProperty(“AccountKey”, “YourAccountKeyHere”); _urlConn.addRequestProperty(“UniqueUserID”, “YourUniqueUserID”); BufferedReader br = new BufferedReader(new InputStreamReader(_urlConn.getInputStream())); …
  33. 33. Calling the Web Service II String line = null; StringBuilder strBuilder = new StringBuilder(); while ((line = br.readLine()) != null) { strBuilder.append(line); System.out.println(line); }}
  34. 34. Calling the Web Service III String[] IProperties = strBuilder.toString().split("<m:properties>"); for (String str : IProperties) { ATM atm = new ATM(); atm.setName(Utils.getStringBetween(str, “<d:Name>”, “</d:Name>”)); atm.setRoad(Utils.getStringBetween(str, “<d:Road>”, “</d:Road>”)); atm.setPostal(Utils.getStringBetween(str, “<d:Postal>”, “</d:Postal>”)); atmList.add(atm); } } catch(...) { } return atmList;}
  35. 35. www.projectnimbus.org
  36. 36. innovativesingapore.comtwitter.com/innovativesg
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×