douglas boling president boling consulting inc. wem202
TRANSCRIPT
![Page 1: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/1.jpg)
![Page 2: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/2.jpg)
Building a Picture Frame, Part 3: Connect a Windows Embedded CE Device to Web Services Douglas Boling
PresidentBoling Consulting Inc.WEM202
![Page 3: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/3.jpg)
Speaker
Douglas Boling Author – Programming Microsoft Windows CE
4th EditionTrainer – Classes on Windows CE App DevelopmentWindows CE OAL Development.NET Compact FrameworkConsultant – Work with companies to help their Windows CE application and platform development efforts
![Page 4: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/4.jpg)
Agenda
Introduction to Web Services
Implementing a Web Service Client
Understanding RSS Feeds
Connecting the Picture Frame
![Page 5: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/5.jpg)
Agenda
Introduction to Web ServicesWhat is a web serviceDesktop/Server supportTools to write web service clients
Implementing a Web Service Client
Understanding RSS Feeds
Connecting the Picture Frame
![Page 6: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/6.jpg)
What is a Web Service?
Web services are ‘programmatic’ web sitesUsing the web w/o “screen scraping”RPC protocol using port 80
Uses “SOAP” Simple Object Access ProtocolAll data transmitted as strings
![Page 7: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/7.jpg)
Server sideMicrosoft support via ASPSimple to implement with ASP .NET
Client sideSimple to implement via .NET frameworkNative clients implemented with ATL
Desktop/Server Support
![Page 8: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/8.jpg)
Visual Studio provides supportServer sideClient side
.NET commonly used for both sides
Native implementations can workClient – ATL sample today Server – Mike Hall example on CE
http://blogs.msdn.com/mikehall/archive/2007/10/10/building-xml-web-services-for-windows-embedded-ce-6-0.aspx
Tools To write Web Service Clients
![Page 9: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/9.jpg)
Writing a Web Service
Simple, with ASP.NET
First example…Add two numbers
VS 2005/2008 cautionDefaults to Local Development Server
Services can’t be seen by CE devices/emulatorsIIS configuration difficult!
![Page 10: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/10.jpg)
Agenda
Introduction to Web Services
Implementing a Web Service ClientNativeManaged
Understanding RSS Feeds
Connecting the Picture Frame
![Page 11: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/11.jpg)
Native Web Service Client
Start with a simple device application
Add ATL support
Allow single threads in MTA
Increase stack size
![Page 12: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/12.jpg)
Native Web Service Client
Add Web Reference
Include webref.h in stdafx.h
Create web client class
Call method
![Page 13: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/13.jpg)
A Managed Web Service Client
Simple .NET Windows Forms App
Add web reference
“New up” the web reference object
Call methods
![Page 14: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/14.jpg)
Web ServicesDouglas BolingPresidentBoling Consulting Inc.
demo
![Page 15: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/15.jpg)
Agenda
Introduction to Web Services
Implementing a Web Service Client
Understanding RSS Feeds
Connecting the Picture Frame
![Page 16: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/16.jpg)
Project
Create a picture frame that connects to web
Change of plans…Use RSS instead of Web Service
![Page 17: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/17.jpg)
New Project
Web based pictures at FrameIt.ComPart of Windows Live Services
Use RSS feed to query pictures
Download and display pictures
![Page 18: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/18.jpg)
RSS – “Really Simple Syndication”
Web feed format for frequently updated content
XML document describes feed content
Many readers availableWe’re going to write a trivial one here
![Page 19: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/19.jpg)
Example RSS XML Feed
<?xml version="1.0" encoding="utf-8"?><rss version="2.0“ xmlns:frameit="http://www.frameit.live.com/firss/" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <ttl>287</ttl> <title>DemoCollection</title> <link>http://frameit.live.com</link> <generator>http://frameit.live.com</generator> <lastBuildDate>Tue, 12 May 2009 13:14:49 -0700 </lastBuildDate> <pubDate>Tue, 12 May 2009 14:27:19 -0700</pubDate> <description></description>
<item>…</item> <item>…</item> <item>…</item></channel>
![Page 20: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/20.jpg)
Example RSS XML Item
<item> <frameit:sourceIcon>xxxxx</frameit:sourceIcon>
<frameit:sourceCategory>Custom</frameit:sourceCategory>
<frameit:sourceName>Windows Live Photos </frameit:sourceName>
<title>Paris</title>
<link>http://0mxaeg.blu.live/…/DSCN0360.JPG</link>
<category>Paris</category>
<guid isPermaLink="true"> http://0mxaeg.blu.live/…/DSCN0360.JPG</guid>
![Page 21: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/21.jpg)
Example RSS XML Item (2)
<description><![CDATA[ <img src= "http://0mxaeg.blu.live/…/DSCN0360.JPG“ /><br/>]]></description>
<pubDate>Mon, 30 Mar 2009 17:30:42 -0700</pubDate>
<enclosure type="image/jpeg“ url="http://0mxaeg.blu.live/…/DSCN0360.JPG" />
<media:content type="image/jpeg" url="http://0mxaeg.blu.live/…/DSCN0360.JPG" />
</item>
![Page 22: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/22.jpg)
Agenda
Introduction to Web Services
Implementing a Web Service Client
Understanding RSS Feeds
Connecting the Picture FrameNativeManaged
![Page 23: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/23.jpg)
Tasks of Native Application
Connect to RSS feed
Download XML describing feed
Parse XML
Download images
![Page 24: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/24.jpg)
Connecting Using WinINet
WinINet library provides higher level access to web
APIs for Initialize the libraryConnect to serverDownload file
![Page 25: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/25.jpg)
Initializing WinINet
To initialize WinINet call InternetOpen
Parameters:Agent String to indicate client typeAccess type Indicates proxy or direct connectProxy Name Name of proxy serverFlags
![Page 26: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/26.jpg)
Connecting to a Server
To connect to a server, use InternetConnect
Parameters:lpszServerName Name of servernServerPort Port to connectlpszUserName Optional user namelpszPassword Optional passworddwService HTTP or FTPA few others…
![Page 27: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/27.jpg)
Reading A File
Use the following functionsHttpOpenRequestHttpAddRequestHeadersHttpSendRequest
If successful, loop onHttpQueryInfoInternetQueryDataAvailableInternetReadFile
![Page 28: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/28.jpg)
Native Picture Frame RSS Reader CodeDouglas BolingPresidentBoling Consulting Inc.
demo
![Page 29: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/29.jpg)
Picture Frame in Managed Code
Managed code much simpler than native
Use WebRequest class to read data
Use XMLReader to parse the RSS XML
Use PictureBox to display image
![Page 30: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/30.jpg)
Download A File
// Compose the request WebRequest request=WebRequest.Create ("http://parisfeed.frameit.com");
WebResponse response = request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
string strXMLFeed = sr.ReadToEnd(); response.Close(); // Write the string into a file StreamWriter sw = new StreamWriter(strXMLFile); sw.Write(strXMLFeed); sw.Close();
![Page 31: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/31.jpg)
Parse The Feed
XmlTextReader reader = new XmlTextReader(strFilename);
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.Element:
if (reader.Name == "enclosure“) {
if (reader.AttributeCount > 0) {
strURL = reader.GetAttribute("url");
if (null != strURL) ar.Add(strURL); } break; } }
![Page 32: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/32.jpg)
Managed Frame RSS Reader CodeDouglas BolingPresidentBoling Consulting Inc.
demo
![Page 33: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/33.jpg)
Summary
Web services client support available in Windows Embedded CE
Managed much easier than native
RSS feeds aren’t that difficultAgain… Managed much easier than native
![Page 34: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/34.jpg)
question & [email protected]
![Page 35: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/35.jpg)
Windows Embedded Resources
Website: www.windowsembedded.com
Social Channels: blogs.msdn.com/mikehallblogs.msdn.com/obloch
Technical Resources: http://msdn.microsoft.com/embedded
Tools evaluations: www.windowsembedded.com/downloads
![Page 36: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/36.jpg)
www.microsoft.com/teched
Sessions On-Demand & Community
http://microsoft.com/technet
Resources for IT Professionals
http://microsoft.com/msdn
Resources for Developers
www.microsoft.com/learningMicrosoft Certification and Training Resources
www.microsoft.com/learning
Microsoft Certification & Training Resources
Resources
![Page 37: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/37.jpg)
Complete an evaluation on CommNet and enter to win!
![Page 38: Douglas Boling President Boling Consulting Inc. WEM202](https://reader035.vdocument.in/reader035/viewer/2022062321/56649db45503460f94aa4466/html5/thumbnails/38.jpg)
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.