<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://feeds.qzone.qq.com/rss.xsl" version="1.0"?>
<rss version="2.0" xmlns:qz="http://qzone.qq.com">
<channel>
<title><![CDATA[神猪复活]]></title>
<description><![CDATA[做人如拉屎]]></description>
<link>http://3480251.qzone.qq.com</link>
<lastBuildDate>Tue, 18 Nov 2008 22:10:03 GMT</lastBuildDate>
<generator>Qzone</generator>
<language>zh-cn</language>
<copyright>Copyright (C), 2005-2008, Tencent Tech. Co., Ltd.</copyright>
<pubDate>Tue, 07 Oct 2008 02:45:26 GMT</pubDate>

<item>
<title><![CDATA[如何使WebService支持HttpGet]]></title>
<link>http://3480251.qzone.qq.com/blog/1223347526</link>
<description><![CDATA[<br><br>        在VS2005写了一个webservice，但不支持HttpGet的方法，怎样才能使其支持Get呢？很简单，只需要在网站的Web.Config配置文件中加上而下几行就OK了。 <br><br>        &lt;configuration&gt; <br>          &lt;!-- 省略N行 ... ... --&gt; <br>          &lt;webServices&gt; <br>            &lt;protocols&gt; <br>              &lt;add name=&quot;HttpGet&quot;/&gt; <br>              &lt;add name=&quot;HttpPost&quot;/&gt; <br>              &lt;add name=&quot;Documentation&quot;/&gt; <br>            &lt;/protocols&gt; <br>          &lt;/webServices&gt; <br>        &lt;/configuration&gt; <br><br>        完。 : ) <br> <br> <br>]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[3480251@qq.com(神猪复活)]]></author>
<comments>http://3480251.qzone.qq.com/blog/1223347526#comment</comments>
<qz:effect>576</qz:effect>
<pubDate>Tue, 07 Oct 2008 02:45:26 GMT</pubDate>
<guid>http://3480251.qzone.qq.com/blog/1223347526</guid>
</item>

<item>
<title><![CDATA[返回自定义格式XML的WebService]]></title>
<link>http://3480251.qzone.qq.com/blog/1223345328</link>
<description><![CDATA[<br><br>        blog里还没有文章呢，想来想去不知道写什么好，干脆写个有关webservice的示例文章吧。 <br><br>        首先，我们必须了解什么是webservice。就概念上来说，可能比较复杂，不过我们可以有个宏观的了解：webservice就是个对外的接口，里面有函数可供外部客户调用（注意：里面同样有客户不可调用的函数）。假若我们是服务端，我们写好了个webservice，然后把它给了客户（同时我们给了他们调用规则），客户就可以在从服务端获取信息时处于一个相对透明的状态。即是客户不了解（也不需要）其过程，他们只获取数据。 <br><br>        在VS2005中，开发一个webservice并不是件困难的事。首先，我们新建一个webservice项目（文件-&gt;新建-&gt;项目-&gt;C#-&gt;Web服务应用程序） <br><br>        建完这个工程，我们将看到一个叫Service1.asmx的文件，这就是webservice的标准文件，它也有UI的概念，不过我们一般不关注。因此，我们查看其cs代码文件，如果你什么都还没做的话，将看见一个helloworld的WebMethod，运行，你就可以得到最简单的webservice运行实例了。点击&quot;helloworld&quot;将执行其方法，显然,这个函数对我们的意义只在于宏观的了解了下web服务的写法。 <br>     <br>        [WebMethod] <br>        public string HelloWorld() <br>        { <br>            return &quot;Hello World&quot;; <br>        } <br><br>        在代码文件里，如果我们写了一个函数后，希望此函数成为外部可调用的接口函数。我们必须在函数上面添上一行代码[WebMethod]，如果你的函数没有这个申明，它将不能被用户引用。在[WebMethod]里可以加上Description来描述函数，如：[WebMethod(Description=&quot;函数的描述信息&quot;)]，以上是一个最简单的webservice。 <br><br>        然而在实际应用中，需要从webservice返回的XML是按客户需求来定义，那么如何从webservice返回自定义的XML格式呢？可以按以下的代码写。 <br><br>        [WebMethod(Description = &quot;自定义xml格式化&quot;)] <br>        public XmlDataDocument MyXML() <br>        { <br>            XmlDataDocument xd = new XmlDataDocument(); <br>            string xml = &quot;&lt;mydata&gt;one test&lt;/mydata&gt;&quot;; //可根据自己的实际需要组合所需字符串 <br>            xd.LoadXml(xml); <br>            return xd; <br>         } <br><br>        这样就可以按客户的需要返回自定义格式的XML了。 <br>        <br>        完。 : ) <br><br><br><br>　　]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[3480251@qq.com(神猪复活)]]></author>
<comments>http://3480251.qzone.qq.com/blog/1223345328#comment</comments>
<qz:effect>592</qz:effect>
<pubDate>Tue, 07 Oct 2008 02:08:48 GMT</pubDate>
<guid>http://3480251.qzone.qq.com/blog/1223345328</guid>
</item>

</channel>
</rss>

