<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Web Services</title><link>http://blogs.clearscreen.com/migs/category/44.aspx</link><description>exposure of my knowledge about common webservices and wse security implementations with wse2.0</description><managingEditor>Miguel Jiménez</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Miguel Jiménez</dc:creator><title>Water Inspector Gadget, a simple incursion into Sidebar Gadgets</title><link>http://blogs.clearscreen.com/migs/archive/2006/12/04/4930.aspx</link><pubDate>Mon, 04 Dec 2006 22:01:00 GMT</pubDate><guid>http://blogs.clearscreen.com/migs/archive/2006/12/04/4930.aspx</guid><wfw:comment>http://blogs.clearscreen.com/migs/comments/4930.aspx</wfw:comment><comments>http://blogs.clearscreen.com/migs/archive/2006/12/04/4930.aspx#Feedback</comments><slash:comments>121</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/migs/comments/commentRss/4930.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/migs/services/trackbacks/4930.aspx</trackback:ping><description>&lt;p&gt;A lot of people asked me about the percentage in my messenger nickname. Some of them thought it was the actual completion state of any of the project I'm involved, and they were wondering how in hell was I able to measure it so precisely.&lt;/p&gt; &lt;p&gt;In fact, the percentage in my nickname (actually 63,78%) is not related to technology, but to nature. It's the level of the water reserve in Madrid. I've been monitoring it during the last 5 or 6 weeks. Daily. Going to the local water company and checking it manually. It actually surprised me how we moved from a poor 27% to the actual reserve in such a little time frame. Amazing. And obviously, it's pretty welcomed.&lt;/p&gt; &lt;p&gt;But this task it's boring. Really boring. I wanted that info directly on my desktop. So, this seemed like a perfect place for &lt;a href="http://en.wikipedia.org/wiki/Inspector_Gadget"&gt;Inspector Gadget&lt;/a&gt; to play with Vista!!!&lt;/p&gt; &lt;p&gt;We first need a simple Html page to host all the gadget code. It's simple javascript + html, also know as the pretty famous dhtml. We then need a simple icon to show in the Gadget Library and of course bunch of nice javascript intervals, json, webservices, xml and xsl parsers to get all the data.&lt;/p&gt; &lt;p&gt;So I managed to get access to a &lt;a href="http://www.cyii.es/www/servlet/EmbalseServlet" target="_blank"&gt;webservice providing the percentage of water reserve for Madrid&lt;/a&gt; and wrote the code to embed it into a Gadget, dragged it to my Sidebar and &lt;em&gt;et voilá!&lt;/em&gt; it's doing the hard work for me.&lt;/p&gt; &lt;p&gt;&lt;img src="http://blogs.clearscreen.com/migs/files/Agua01VistaGadget.jpg" /&gt;&lt;/p&gt; &lt;p&gt;If you feel like curious about how it's done, download the actual Agua Gadget and inspect the code. It's pretty simple yet. I plan to upgrade it to support settings, nicer graphics and be able to monitor more areas of Spain (my current knowledge about water distribution is limited to Spain, but if you know any source of data to your region, don't hesitate to contact me and I would love to include it)&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.clearscreen.com/migs/files/Agua_01_VistaGadget.zip"&gt;Download Agua Gadget 0.1&lt;/a&gt; for Windows Vista. To install, simply unzip it and double click de .gadget file. Windows Vista would install it for you :)&lt;/p&gt; &lt;p&gt;You can find more info on how to create a basic &lt;a href="http://msdn2.microsoft.com/en-us/library/ms723694.aspx" target="_blank"&gt;Sidebar Gadget at this step by step tutorial&lt;/a&gt; and more info at the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa965853.aspx"&gt;System.Gadget namespace reference&lt;/a&gt;.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/migs/aggbug/4930.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>A lot of people asked me about the percentage in my messenger nickname. Some of them thought it was the actual completion state of any of the project I'm involved, and they were wondering how in hell was I able to measure it so precisely.</p> <p>In fact, the percentage in my nickname (actually 63,78%) is not related to technology, but to nature. It's the level of the water reserve in Madrid. I've been monitoring it during the last 5 or 6 weeks. Daily. Going to the local water company and checking it manually. It actually surprised me how we moved from a poor 27% to the actual reserve in such a little time frame. Amazing. And obviously, it's pretty welcomed.</p> <p>But this task it's boring. Really boring. I wanted that info directly on my desktop. So, this seemed like a perfect place for <a href="http://en.wikipedia.org/wiki/Inspector_Gadget">Inspector Gadget</a> to play with Vista!!!</p> <p>We first need a simple Html page to host all the gadget code. It's simple javascript + html, also know as the pretty famous dhtml. We then need a simple icon to show in the Gadget Library and of course bunch of nice javascript intervals, json, webservices, xml and xsl parsers to get all the data.</p> <p>So I managed to get access to a <a href="http://www.cyii.es/www/servlet/EmbalseServlet" target="_blank">webservice providing the percentage of water reserve for Madrid</a> and wrote the code to embed it into a Gadget, dragged it to my Sidebar and <em>et voilá!</em> it's doing the hard work for me.</p> <p><img src="http://blogs.clearscreen.com/migs/files/Agua01VistaGadget.jpg" /></p> <p>If you feel like curious about how it's done, download the actual Agua Gadget and inspect the code. It's pretty simple yet. I plan to upgrade it to support settings, nicer graphics and be able to monitor more areas of Spain (my current knowledge about water distribution is limited to Spain, but if you know any source of data to your region, don't hesitate to contact me and I would love to include it)</p> <p><a href="http://blogs.clearscreen.com/migs/files/Agua_01_VistaGadget.zip">Download Agua Gadget 0.1</a> for Windows Vista. To install, simply unzip it and double click de .gadget file. Windows Vista would install it for you :)</p> <p>You can find more info on how to create a basic <a href="http://msdn2.microsoft.com/en-us/library/ms723694.aspx" target="_blank">Sidebar Gadget at this step by step tutorial</a> and more info at the <a href="http://msdn2.microsoft.com/en-us/library/aa965853.aspx">System.Gadget namespace reference</a>.</p><img src ="http://blogs.clearscreen.com/migs/aggbug/4930.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Miguel Jiménez</dc:creator><title>.NET WebService Studio 2.0 and more WebServices Tools</title><link>http://blogs.clearscreen.com/migs/archive/2004/07/06/361.aspx</link><pubDate>Tue, 06 Jul 2004 15:42:00 GMT</pubDate><guid>http://blogs.clearscreen.com/migs/archive/2004/07/06/361.aspx</guid><wfw:comment>http://blogs.clearscreen.com/migs/comments/361.aspx</wfw:comment><comments>http://blogs.clearscreen.com/migs/archive/2004/07/06/361.aspx#Feedback</comments><slash:comments>76</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/migs/comments/commentRss/361.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/migs/services/trackbacks/361.aspx</trackback:ping><description>&lt;P&gt;I've needed to test some webservices that were only accepting SOAP messages and didn't had the time enough to write a consumer and test the webmethods. Just for this cases, I have a very very useful tool called .NET WebService Studio 2.0 from Sowmy Srinivasan that does it perfectly. It evens support WSE extensions, but unfortunately WSE 2.0 it's not supported yet...&lt;/P&gt;
&lt;P&gt;And more on Webservices tools, have a look to the list that &lt;A href="http://weblogs.asp.net/beatsch"&gt;Beat Schwegler&lt;/A&gt; is building in his post &lt;A id=viewpost.ascx_TitleUrl href="http://weblogs.asp.net/beatsch/archive/2004/02/12/71782.aspx"&gt;Tools for a Web Service World...&lt;/A&gt; &lt;/P&gt;&lt;img src ="http://blogs.clearscreen.com/migs/aggbug/361.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Miguel Jiménez</dc:creator><title>WSE 2.0 Custom Tokens are not fully working on distributed systems and throw a WSE511 error message</title><link>http://blogs.clearscreen.com/migs/archive/2004/06/25/351.aspx</link><pubDate>Fri, 25 Jun 2004 13:40:00 GMT</pubDate><guid>http://blogs.clearscreen.com/migs/archive/2004/06/25/351.aspx</guid><wfw:comment>http://blogs.clearscreen.com/migs/comments/351.aspx</wfw:comment><comments>http://blogs.clearscreen.com/migs/archive/2004/06/25/351.aspx#Feedback</comments><slash:comments>114</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/migs/comments/commentRss/351.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/migs/services/trackbacks/351.aspx</trackback:ping><description>&lt;P&gt;I've recently worked on an internal Microsoft project using WSE 2.0 to implement a Kerberos-like authentication and authorization system for webservices but based on custom BinarySecurityTokens... Finally I've developed a full kit of tokens, tickets and token managers that are used in separate web services to implement the custom system using the ws-security provided by WSE 2.0&lt;/P&gt;
&lt;P&gt;Every worked fine, the unit testing was green, the tokens and tickets were sent and received, and managed by the token managers... but every failed when we put all the engine in separate distributed machine: we started to get the famous "An invalid Security token was received" error message... To see the full exceptions thrown by the webservices I had to modify the &amp;lt;customErrors&amp;gt; tag and add the remoteOnly=Off attribute to allow propagation of exceptions to the callee of the .asmx and in this point is where the unknown WSE511 error came up&lt;/P&gt;
&lt;P&gt;The WSE511 error is thrown as an exception when the WSE engine receives a token and after it's loaded performs a call to the IsCurrent() method of the SecurityToken class to check&amp;nbsp;the expiration and creation dates. Actually, this method calls the IsCurrent() method of the LifeTime member of the token. The way this&amp;nbsp;is coded in the WSE 2.0 binaries will fail most of the times because the use the following code to perform the comparison:&lt;/P&gt;
&lt;P&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt; 
&lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;// LifeTime.IsCurrent()&lt;/span&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;bool&lt;/span&gt; IsCurrent
{
      get
      {
            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; ((&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;this&lt;/span&gt;._created !&lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;this&lt;/span&gt;._created.IsPostDated())
            {
                  &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;false&lt;/span&gt;;
            }
            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;this&lt;/span&gt;._expires !&lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;null&lt;/span&gt;)
            {
                  &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; !&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;this&lt;/span&gt;._expires.IsExpired();
            }
            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;true&lt;/span&gt;;
      }
}
 


&lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;// LifeTime.Created.IsPosdated()&lt;/span&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;bool&lt;/span&gt; IsPostDated()
{
      &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;base&lt;/span&gt;.Value == DateTime.MinValue)
      {
            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;false&lt;/span&gt;;
      }
      &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; DateTime.op_LessThan(DateTime.Now, &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;base&lt;/span&gt;.Value);
}
 


&lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;// LifeTime.Expires.IsExpired()&lt;/span&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;bool&lt;/span&gt; IsExpired()
{
      &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;if&lt;/span&gt; (&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;base&lt;/span&gt;.Value == DateTime.MaxValue)
      {
            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;false&lt;/span&gt;;
      }
      &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; DateTime.op_GreaterThan(DateTime.Now, &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;base&lt;/span&gt;.Value);
}
 


&lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;// op_LessThan() operator used by LifeTime.Created.IsPosdated()&lt;/span&gt;
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;static&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;bool&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;operator&lt;/span&gt; &amp;lt;(DateTime t1, DateTime t2)
{
      &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; (t1.ticks &amp;lt; t2.ticks);
}
&lt;/span&gt;&lt;/pre&gt; &lt;/P&gt;
&lt;P&gt;Based on the above exposed code, when a token have a Lifetime with creation and expiration date, the WSE runtime is performing a comparision between the Datetime.Now.ticks and the Token.CreatedDate.ticks... this is throwing the exception, because the servers where the webservices are hosted can't be synchronized at ticks level, not even when on the same domain. So this operation should fail on the call or in the response of the soap message, throwing the WSE511 error telling you that the token is Postdated.&lt;/P&gt;
&lt;P&gt;I've corrected this by overriding the IsCurrent method of the Token, and&amp;nbsp; instead of calling to the IsCurrent method of the Lifetime member I wrote a line of code to perform the check by myself. This is a quick solution, but I will provide a more elegant version of it that checks the web.config for the webservices2 config section and reads a value already defined in WSE2.0 for this kind of issue that is never used in the LifeTime.IsPostdated() method&lt;/P&gt;
&lt;P&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt; 
&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;override&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;bool&lt;/span&gt; IsCurrent
{
 get
        {
  &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;// hardcoded a 300 seconds timeframe to allow the ispostdated&lt;/span&gt;
         &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;return&lt;/span&gt; (LifeTime == &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px"&gt;null&lt;/span&gt; || (DateTime.Now &amp;gt; LifeTime.Created.AddSeconds(-300)));

        }
}
&lt;/span&gt;&lt;/pre&gt; &lt;/P&gt;
&lt;P&gt;Of course, three hundred seconds is too much time, but I just wanted to check that it solved the issue. And it did!!!! With this correction to the code of your custom Tokens (binary or xml) you can run you WSE 2.0 enabled web services over different domains, machines and everything you want... &lt;/P&gt;
&lt;P&gt;Btw: is this a bug of WSE2.0? Has anyone at the WSE Team tested this? Or is there any other formal issue provided by the team to solve this issue?&lt;/P&gt;&lt;img src ="http://blogs.clearscreen.com/migs/aggbug/351.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Miguel Jiménez</dc:creator><title>Agile methodologies and unit testing with Webservices, what a headache!!</title><link>http://blogs.clearscreen.com/migs/archive/2004/06/12/325.aspx</link><pubDate>Sat, 12 Jun 2004 17:08:00 GMT</pubDate><guid>http://blogs.clearscreen.com/migs/archive/2004/06/12/325.aspx</guid><wfw:comment>http://blogs.clearscreen.com/migs/comments/325.aspx</wfw:comment><comments>http://blogs.clearscreen.com/migs/archive/2004/06/12/325.aspx#Feedback</comments><slash:comments>97</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/migs/comments/commentRss/325.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/migs/services/trackbacks/325.aspx</trackback:ping><description>&lt;P&gt;I've started to work in a new project within MS in Spain and we are applying Agile methodologies like Scrum. Also proven techniques as Test Driven Development and Refactoring are currently used. This techniques are amazing, they really improve your code and the way you code. You really get engaged to this unit testing development. I've you haven't tried it out yet, please try it.&lt;/P&gt;
&lt;P&gt;But... there's always a but... Unit testing is really easy to implement and use when developing assemblies and not so easy to implement when developing Web Services. Due to the project requirements, we are using WSE 2.0 and a bunch of distributed calls to web services that are giving us big headaches to get them correctly tested.&lt;/P&gt;
&lt;P&gt;There is no problem when testing in local machines and accessing to the webservices from there, but in the build and testing environment every test must pass without needing to install the webservices.&lt;/P&gt;
&lt;P&gt;The testing evangelist of the project, aka Rido, provided us with info about mock objects implementation for webservices unit testing, but it's a really difficult task implement a mock object that will encapsulate the WSE2.0 objects and behavior that will be derived into the webservices we build. We are having serious problems with this.&lt;/P&gt;
&lt;P&gt;I'll try to create a base class that implements the WSE Soap-Context that can be used to develop mock objects for unit testing based on webservices interfaces. I'll post it here as soon as a finish it.&lt;/P&gt;&lt;img src ="http://blogs.clearscreen.com/migs/aggbug/325.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Miguel Jiménez</dc:creator><title>Web Services Enhancements 2.0 has been released</title><link>http://blogs.clearscreen.com/migs/archive/2004/05/25/303.aspx</link><pubDate>Tue, 25 May 2004 11:50:00 GMT</pubDate><guid>http://blogs.clearscreen.com/migs/archive/2004/05/25/303.aspx</guid><wfw:comment>http://blogs.clearscreen.com/migs/comments/303.aspx</wfw:comment><comments>http://blogs.clearscreen.com/migs/archive/2004/05/25/303.aspx#Feedback</comments><slash:comments>60</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/migs/comments/commentRss/303.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/migs/services/trackbacks/303.aspx</trackback:ping><description>&lt;P&gt;Finally, WSE 2.0 has been released. It provides an add-on to Visual Studio .NET to support the latest web services specifications and capabilities such as ws-trust, ws-security and much more. &lt;/P&gt;
&lt;P&gt;Have it a look at &lt;A href="http://msdn.microsoft.com/webservices/building/wse/"&gt;Web Services Developer Center&lt;/A&gt;&lt;/P&gt;&lt;img src ="http://blogs.clearscreen.com/migs/aggbug/303.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>