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.

170<br />

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

}<br />

catch<br />

{<br />

return String.Empty;<br />

}<br />

finally<br />

{<br />

if (xmlWriter != null)<br />

xmlWriter.Close();<br />

}<br />

}<br />

The DataTable has the facility to write XML to an XMLWriter. This XMLWriter can<br />

then write to a memory stream that can be read out as a string. Thus, the XML is loaded<br />

into a string that can be returned. And as the string is a simple data type, it can be passed<br />

across the wire without a DataContract.<br />

Now, to control how this service behaves, you’ll use the <strong>Web</strong>.config file. Here’s a<br />

sample <strong>Web</strong>.config file that will work with this service. You’ll build on this later to provide<br />

attributes such as security to your service.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!