<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://prowyh.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fprowyh.spaces.live.com%2fcategory%2fWebServices%2bNotes%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>prowyh's space: WebServices Notes</title><description /><link>http://prowyh.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catWebServices%2bNotes</link><language>en-US</language><pubDate>Wed, 03 Sep 2008 02:57:19 GMT</pubDate><lastBuildDate>Wed, 03 Sep 2008 02:57:19 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://prowyh.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-1537263819930693984</live:id><live:alias>prowyh</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>关于WebService.htc的一个小问题</title><link>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!352.entry</link><description>&lt;div&gt;
&lt;div style=""&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;要在IE浏览器中访问Web Services，必须要将webservice.htc以如上的形式嵌入页面中。&lt;a href="http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/behaviors/library/webservice/default.asp"&gt;webservice.htc&lt;/a&gt;是Microsoft开发的访问远程Web Services的客户端proxy component。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;由于IE7增强了安全方面的设置，有可能会造成webservice.htc不能正常装载。如图所示，要在IE7中正常装载Behavior文件，必须Enable Binary and script behaviors。&lt;/div&gt;
&lt;div&gt;&lt;img alt="" src="http://farm1.static.flickr.com/210/484844219_4ea9b7f061.jpg?v=0"&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1537263819930693984&amp;page=RSS%3a+%e5%85%b3%e4%ba%8eWebService.htc%e7%9a%84%e4%b8%80%e4%b8%aa%e5%b0%8f%e9%97%ae%e9%a2%98&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=prowyh.spaces.live.com&amp;amp;GT1=prowyh"&gt;</description><comments>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!352.entry#comment</comments><guid isPermaLink="true">http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!352.entry</guid><pubDate>Sat, 05 May 2007 10:18:25 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://prowyh.spaces.live.com/blog/cns!EAAA8AB356F88EA0!352/comments/feed.rss</wfw:commentRss><wfw:comment>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!352.entry#comment</wfw:comment><dcterms:modified>2007-05-05T10:23:27Z</dcterms:modified></item><item><title>Puzzled by WebServices</title><link>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!342.entry</link><description>&lt;div&gt;在BMP系统中，针对Web环境中用户认证的非安全性，设计了一种基于CHAP（Challenge Handshake Authentication Protocol）协议的用户认证模型，但在用WebServices实现身份验证时，发现在WebServices中，HttpContext.Current.Session为Null！而ASP.NET的其它对象如Application、Server、Request、Response却都可访问！&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;为什么没有Session对象呢？在折腾了一天之后，发现问题出在WebMethodAttribute。WebMethodAttribute的EnableSession属性在默认情况下为false，只要将EnableSession设置为true，就可以访问Session对象了。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;[WebMethod Description=&amp;quot;This is a service method which used to return the value of a session variable.&amp;quot;, EnableSession=true]&lt;/div&gt;
&lt;div&gt;public string GetSessionValue()&lt;/div&gt;
&lt;div&gt;{&lt;/div&gt;
&lt;div&gt;    string sValue = (string)HttpContext.Current.Session[&amp;quot;aVariable&amp;quot;];&lt;/div&gt;
&lt;div&gt;    return sValue;&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;MSDN上说，如果不需要用到Session，则应将EnableSession设置为false，这样可以提高性能。所以其初始值为false。如果需要用到Session，则需要将其设置为true，否则Session对象在WebServices中不可访问。&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1537263819930693984&amp;page=RSS%3a+Puzzled+by+WebServices&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=prowyh.spaces.live.com&amp;amp;GT1=prowyh"&gt;</description><comments>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!342.entry#comment</comments><guid isPermaLink="true">http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!342.entry</guid><pubDate>Thu, 05 Apr 2007 04:50:27 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://prowyh.spaces.live.com/blog/cns!EAAA8AB356F88EA0!342/comments/feed.rss</wfw:commentRss><wfw:comment>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!342.entry#comment</wfw:comment><dcterms:modified>2007-05-05T10:21:11Z</dcterms:modified></item><item><title>关于WebServices的一点注记</title><link>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!333.entry</link><description>&lt;div&gt;《Core C# and .NET》以及.NET的资料关于DataList.asmx文件的WebService指令的说明：Class=&amp;quot;LevenSite.DataList, DataList&amp;quot;意味WebService的代码封装在DataList.dll文件中，这样DataList.asmx文件就只有这一行指令，这样即可有效保护代码的知识产权。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;DataList.asmx.cs文件源代码：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;using System;&lt;/div&gt;
&lt;div&gt;using System.Web;&lt;/div&gt;
&lt;div&gt;using System.Web.Services;&lt;/div&gt;
&lt;div&gt;namespace LevenSite&lt;/div&gt;
&lt;div&gt;{&lt;/div&gt;
&lt;div&gt;    [WebService(Namespace = &amp;quot;&lt;a href="http://www.levensoft.com/WebService"&gt;http://www.levensoft.com/WebService&lt;/a&gt;&amp;quot;)]&lt;/div&gt;
&lt;div&gt;    public class DataList : System.Web.Services.WebService&lt;/div&gt;
&lt;div&gt;    {&lt;/div&gt;
&lt;div&gt;        public DataList()&lt;/div&gt;
&lt;div&gt;        {&lt;/div&gt;
&lt;div&gt;            InitializeComponent();&lt;/div&gt;
&lt;div&gt;        }&lt;/div&gt;
&lt;div&gt;    }&lt;/div&gt;
&lt;div&gt;    [WebMethod(Description=&amp;quot;GetDataList&amp;quot;)]&lt;/div&gt;
&lt;div&gt;    public string GetDataList()&lt;/div&gt;
&lt;div&gt;    {&lt;/div&gt;
&lt;div&gt;        return &amp;quot;Hello World!&amp;quot;;&lt;/div&gt;
&lt;div&gt;    }&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;这段代码如果放在DataList.asmx中，一切正常，如果调用此WebService，则得到&amp;quot;Hello World!&amp;quot;的结果，但如果将此段代码另存为DataList.asmx.cs并且编译为DataList.dll，从而在DataList.asmx文件中按开头给出的WebService指令调用的话，则出错，原因是DataList.dll文件格式无效。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;经过多次努力后，发现问题出在.NET的版本上，这种代码分离方式只有.NET 2.0支持，.NET 1.x是不支持的！这一点，《Core C# and .NET》以及.NET的文档都没有提及！&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-1537263819930693984&amp;page=RSS%3a+%e5%85%b3%e4%ba%8eWebServices%e7%9a%84%e4%b8%80%e7%82%b9%e6%b3%a8%e8%ae%b0&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=prowyh.spaces.live.com&amp;amp;GT1=prowyh"&gt;</description><comments>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!333.entry#comment</comments><guid isPermaLink="true">http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!333.entry</guid><pubDate>Fri, 23 Mar 2007 14:23:01 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://prowyh.spaces.live.com/blog/cns!EAAA8AB356F88EA0!333/comments/feed.rss</wfw:commentRss><wfw:comment>http://prowyh.spaces.live.com/Blog/cns!EAAA8AB356F88EA0!333.entry#comment</wfw:comment><dcterms:modified>2007-05-15T10:21:28Z</dcterms:modified></item></channel></rss>