08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

176<br />

CHAPTER 7 ■ .<strong>NET</strong> 3.0: WINDOWS COMMUNICATION FOUNDATION<br />

}<br />

d.ReadXml(nRead);<br />

nRead.Close();<br />

GridView1.DataSource = d;<br />

GridView1.DataBind();<br />

}<br />

This code first creates an instance of the address service client (called myAddress-<br />

Service) <strong>and</strong> then uses it to get addresses for the ZIP code 6105. The rest of the code then<br />

reads the results into an XML document, creates a DataSet from it, <strong>and</strong> binds the grid to<br />

this DataSet. As you can see, from a coding point of view, you don’t do anything special to<br />

communicate with the service—everything is h<strong>and</strong>led by the autogenerated proxies,<br />

which were built based on the defined contracts.<br />

Now that you have a simple service that runs with WCF, you can start playing with<br />

how to make it transactable, or add certificate-based security, or use WS-Reliability,<br />

among other things.<br />

A great resource for getting started on this is the Windows SDK. It contains a file<br />

(WCFSamples.zip) that contains step-by-step instructions <strong>and</strong> code on how to achieve the<br />

most common tasks. Check out the extensibility samples in particular.<br />

Summary<br />

This chapter has given you an introduction to WCF <strong>and</strong> how it can be used to navigate<br />

the murky seas of different connectivity technologies <strong>and</strong> st<strong>and</strong>ards without needing to<br />

write thous<strong>and</strong>s of lines of code. WCF is a critical component of .<strong>NET</strong> 3.0, <strong>and</strong> is something<br />

that you will find invaluable as you build the next <strong>Web</strong>. Your need to build<br />

applications that use st<strong>and</strong>ards around security, reliability, transactions, <strong>and</strong> more is only<br />

going to grow over time, <strong>and</strong> this framework is your best friend in empowering this.<br />

You’ve barely scratched the surface of what is possible in this chapter, but hopefully<br />

you’ve gleaned enough to underst<strong>and</strong> how it all works <strong>and</strong> hangs together. For further<br />

resources, take a look through the SDK <strong>and</strong> more in-depth books like Pro WCF: Practical<br />

Microsoft SOA Implementation (Apress, 2007).<br />

In the next chapter, you’ll look at another of the new pillars of .<strong>NET</strong> 3.0—Windows<br />

Presentation Foundation, a technology that can be used to bring your user experience to<br />

the next level. It’s also the big brother of a technology that you’ll be seeing a lot of in the<br />

future of the <strong>Web</strong>: <strong>Silverlight</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!