<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/07/web-services-made-easy.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2009://34.37400-</id>
  <updated>2009-11-16T14:52:22Z</updated>
  <title>Comments for Web Services Made Easy (http://www.insideria.com/2009/07/web-services-made-easy.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2009://34.37400</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/07/web-services-made-easy.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=37400" title="Web Services Made Easy" />
    <published>2009-07-05T01:30:52Z</published>
    <updated>2009-07-04T23:09:18Z</updated>
    <title>Web Services Made Easy</title>
    <summary><![CDATA[Lots of RIA's use web services, and one of the more tedious parts of writing a service can be looping through all of the rows in a recordset, adding nodes, setting their attributes, etc.&nbsp;I spend a lot of time trawling...]]></summary>
    <author>
      <name>Amy Blankenship</name>
      
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="insideria_developer_diary.gif" src="http://www.insideria.com/riaimages/insideria_developer_diary.gif" width="148" height="148" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></span><p>Lots of RIA's use web services, and one of the more tedious parts of writing a service can be looping through all of the rows in a recordset, adding nodes, setting their attributes, etc.&nbsp;I spend a lot of time trawling through MSDN trying to speed up my development process, and fairly early I found <a href="http://msdn.microsoft.com/en-us/library/ms178107.aspx">an intriguing syntax</a> (SELECT ... FOR XML) that seemed to hold out the promise of allowing SQL Server to do most of the XML coding for me.&nbsp; But what I found is that all the examples took the result of the XML and  put it in a variable of XML type.  It took me a while to figure out how to take that XML and make it available outside the procedure, since if you use normal open recordset syntax, what you wind up with in your one recordset row/column won't populate a DomDocument object properly on the HTML side.&nbsp; All the examples that I could find &quot;stop at the door&quot; as it were, and don't really explain how you take that XML typed &quot;thing&quot; and make it into something that you can load into your DomDocument.</p>
<p>The method I hit on myself is to put the XML object into a variable, cast that to varChar and select that.&nbsp; Then on the page, you can load the string in as XML using the loadXML method of your DomDocument object.</p>
<p>Later, I found <a href="http://www.sitepoint.com/article/data-as-xml-sql-server/3/">this article on SitePoin</a>t which shows a different method, loading a stream instead of a recordset.&nbsp; Arguably it is a better method, though I think mine fits my development style better (I can print the string to the Messages window while developing and feel happy that my XML looks like I want it to).&nbsp; I also prefer the <a href="http://msdn.microsoft.com/en-us/library/ms189885.aspx">Path Mode</a> to Explicit Mode, as I find it more intuitive and less complicated. </p>
<p>Happy coding! </p>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.37400-comment:2067917</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.37400" type="text/html" href="http://www.insideria.com/2009/07/web-services-made-easy.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/07/web-services-made-easy.html#comment-2067917" />
    <title>Comment from Vince on 2009-07-07</title>
    <author>
        <name>Vince</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Open source native XML database <a href="http://exist.sourceforge.net/">http://exist.sourceforge.net/</a> with the following HTTP interfaces: REST, WebDAV, SOAP, XMLRPC, Atom Publishing Protocol</p>]]>
    </content>
    <published>2009-07-08T06:41:59Z</published>
  </entry>

</feed
