Powerd by dasBlog RSS 2.0
 Wednesday, July 09, 2008

We have some WSE 2.0 secured Web Services that we are migrating to a new data center. As part of this migration effort I needed to write some automated tests to make sure everything was working. In addition to working with the WSE 2.0 clients our customers have, I also wanted to see what was needed to make the services consumable by WCF clients. After finding this article on WSE 2.0 Interoperability on http://wcf.netfx3.com, it was pretty easy.

The main problem I was having was issues with the username token. In WCF some basic concepts were changed, such the removal of password encryption (instead recurring the transport, https for example to handle encryption), and replay detection.  

Here is the config section from the WSE 2.0 server piece (the diagnostic piece is optional)

<microsoft.web.services2>
   <security>
      <securityTokenManager xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" qname="wsse:UsernameToken">
         <replayDetection enabled="false"/>
      </securityTokenManager>
   </security>
   <diagnostics>
      <trace enabled="true" input="logs\InputTrace.webinfo" output="logs\OutputTrace.webinfo" />
   </diagnostics>
</microsoft.web.services2>

Here is a sample configuration section for the WCF Client:

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="InventorySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="TransportWithMessageCredential">
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://Server/Directory/Service.asmx"
                binding="basicHttpBinding" bindingConfiguration="InventorySoap"
                contract="MonitoringServices.Inventory.Wcf.InventorySoap"
                name="InventorySoap" />
        </client>
    </system.serviceModel>

Most of the client configuration was created for me when I added a service reference to my project. The key part is the mode=TransportWithMessageCredential and clientCredntialType = “UserName”.

We have another project underway were we want to rewrite the WSE 2.0 services with WCF while maintaining full compatibility with deployed WSE 2.0 clients. The netfx3 article covers this scenario as well, and it seems like we will be able to accomplish our task. Look for a future post on that endeavor.

Wednesday, July 09, 2008 4:30:23 PM UTC  #    Comments [0] - Trackback
Programming
 Monday, July 07, 2008

Today I tried to use the web recorder in Visual Studio to create some new web tests, but the recorder tool bar would not show in IE. A quick search found Diagnosing and fixing Web Test recorder bar issues, by Michael Taute which had several troubleshooting tips.

I ended up changing my home page which is about:blank (and loads when web recorder is launched) to belong to the local intranet zone, as this is where my test site is. That didn’t fix the problem initially, so I deleted the following two registry keys using the 32 bit registry editor (C:\Windows\SysWOW64\regedit.exe):

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}

You need to make sure all instances of IE are closed before deleting the registry keys. Once I did this, my web recorder was up and running. I’ve left about:blank in the local intranet zone for now.

Monday, July 07, 2008 8:24:10 PM UTC  #    Comments [0] - Trackback
Programming
 Friday, July 04, 2008

Once again I need to generate some self signed certs for local development. Installing certificate services in Windows is a bit of an overkill for what I need, however, it would be nice to have a root CA to work with.

After some Googling, I found a site, http://ssl4net.com/ which allows you to create a self signed root CA, and then additional certs signed by the CA you created. It is extremely easy to use and once I got the certs I was able to install them without issue.

My only concern is that the certs do not appear to be encrypted on their server, nor do they use SSL (seems ironic). However, since I will only be using this for internal use, I have no problems with this. I would be a little cautious if I was going to use to verify my identity to other people.

It looks like they might be using open-ssl as the cert creation mechanism, so maybe it’s worth the effort to setting up a VM running linux to generate my own certs in house, but that’s for another day.

Friday, July 04, 2008 4:25:36 AM UTC  #    Comments [0] - Trackback
Programming | Tools
 Monday, June 30, 2008

Monday morning I brought (rather I biked) my laptop back into the office after reformatting and installing Windows Server 2008 on it. FolderShare seems to be holding up rather well, but I ran into an unexpected issue, no Bluetooth. Not just no Bluetooth drivers, there is no bluetooth support in Server 2008.

Thankfully I found a good guide written by Gill that explains how he installed the Microsoft Bluetooth stack on windows server 2008. His guide, and a comment by Crispin Wright, was what I needed to get Bluetooth running on my HP nx9420 business class laptop.

First I followed Gill’s steps for coping the files to a temp folder and changing the INF files. The following list of files I was unable to find in the folder specified, but it turns out they were in the folder created by HP’s Bluetooth driver setup (kind of following Crispin’s instructions for his dell).

  • btwaudio.inf
  • btwaudio.sys
  • btwavdt.inf
  • btwavdt.sys
  • btwrchild.inf
  • btwrchid.sys

I also wrote a powershell scrip to go thru and modify the .inf files.

#Executes a find and replace on all files in the path $includes
#You can pass in a path with a wild card (c:\temp\*.txt)
#Credit: http://www.aaronlerch.com/blog/2007/03/powershell-replace-string-function.html 

function Replace-String($find, $replace, $includes)
{
get-childitem $includes | 
  select-string $find -list |
  % { (get-content $_.Path) |
  % { $_ -replace $find, $replace } |
  set-content $_.Path }
} 

#Actual find replace for blue tooth inf files
Replace-String "amd64...1" "amd64...3" ".\*.inf"

One thing I do was run the HP provided INF files thru the Powershell script as well before I could get the drivers to update. The device I updated first in the Device Manager was the HP Integrated module with a hardware id of USB\VID_03F0&PID_171D&REV_0100. Once this device was updated, then the other blue tooth devices were found, and I just pointed them to my temp BT folder with the updated INF files.

I still have one unknown device, and it appears to be for the Bluethooth PAN profile, but I have been unable to find a driver for it. I thought that I would try running the setup application provided by HP to install their drivers, but even after that, I was still left with that unknown device, so I would recommend not running the HP setup program, as it appears to provide no added benefit.

While installing my Bluetooth keyboard and mouse, I was prompted for drivers, and again, pointed to my temp BT folder to install the HID drivers. I’ve since rebooted a couple of times, and my mouse and keyboard continue to work. I don’t have any other Bluetooth devices to test at this time.

UPDATE:

Looks like I was in a hurry and missed coping the bthpan.inf file in the first step. Gill asked me to take a look again, and sure enough, I hadn’t copied it to my BT temp folder, so it never got updated. Once I made the change, I was able to get the PAN driver installed.

Thanks again Gill.

Monday, June 30, 2008 4:35:55 PM UTC  #    Comments [0] - Trackback
Technology
 Sunday, June 29, 2008

I’m in the process of setting up my work laptop after reformatting and installing Server 2008 64 bit (a change from Vista 32 bit). My primary reason for this was to continue my Hyper-V evaluation that I started at home. I just got an upgrade in the form of 4 GB of ram and a new external hard drive with a FireWire (FireWire 400/800, USB 2.0 and ESATA) for my laptop.

I’ve been using Microsoft Groove for folder synchronization between my home and work computers. Much to my surprise after getting Groove installed and my account moved over to my laptop, I was greeted with an error message indicating that folder synchronization was not supported on a 64 bit OS!?!?!

I think the first hit I got on Google summed up my thoughts, “You got to be kidding?”. Alas, they were not. So I’m back to using Folder Share, which has gotten an upgrade from when I stopped using it just over a year ago. It does in fact support 64 bit, and actually has better limits then Groove, including a max file size of 2GB and 10,000 files per folder. The only major limitation is that you can only have 10 folders shared, but I only need 5-6, maybe 7, so it’s good enough for me right now.

Sunday, June 29, 2008 3:44:56 PM UTC  #    Comments [0] - Trackback
Technology
 Wednesday, June 25, 2008

As part of the migration project I am working on, I have to install, configure and test several Asp.net 1.1 applications on Windows Server 2008 (IIS 7). Asp.Net 1.1 is not part of the default installation, nor is it a feature such as .Net 3.0, but rather a stand alone install that takes some extra steps to get working. If you do a search for asp.net 1.1 on Server 2008, you will get several hits explaining how to install, but that’s not the point of this post.

Basically, Asp.Net 2.0, which is included with Server 2008, is backwards compatible with Asp.Net 1.1. So far, I’ve only found one incompatibility in all of our web applications, and that is related to a change in System.Web.UI.WebControls.ListControl selected index property setter. In .Net 2.0, the setter was re-written such that assigning 0 (zero) to the SelectedIndex property when no items are present in the ListControl will cause an ArgumentOutOfRange exception.

The exact error:

[ArgumentOutOfRangeException: 'lstSites' has a SelectedIndex which is invalid because it does not exist in the list of items. Parameter name: value] System.Web.UI.WebControls.ListControl.set_SelectedIndex(Int32 value) +5138552

I had made a decision that if changes were small enough, I would update the applications in an effort to avoid installing Asp.net 1.1 on Windows Server 2008. This helps by requiring one less thing to install for testing, disaster recovery, and reduces the attack surface of our servers.

Wednesday, June 25, 2008 10:12:02 PM UTC  #    Comments [0] - Trackback

 Monday, June 23, 2008

This one took me a little longer then I figured. Maybe I’m just trying to do stuff the wrong way, but I don’t know, I feel like my use case is correct.

What am I talking about anyway? I am talking about creating a set of web tests in Visual Studio Test Edition (well Team Suite) that I can actually use in a real world situation (i.e. Have tests that work on a dev, staging and production server). The problem is/was, hard coded URLs for my dev server, which ultimately would have to be changed to point at staging and production.

Before proceeding, let me spell out what I’m trying to do (use case):

  • Use the VS GUI to create and most likely run my tests
  • Single place to store the web server, and other settings that I can use for all my tests

At first, I thought this was going to be a very easy change, as there is a “Parameterize Web Servers” option when you right click on the root node of your web test. This creates a context variable, which I thought was cool, until I realized it was on a test by test basis, not project. I guess I was looking for a project wide context parameters file, but couldn’t find one.

I did some searching and supposedly you can set an environmental (yes, from a command prompt) variable named Test.<ContextParameter>, however I was unable to get this to work. I think this might only work when invoking mstest from the command line which makes some sense, but kind of throws a wrench in the works. While this would be perfectly acceptable for a un-attended build server, what if I needed to point to a new dev server in the GUI?

I then moved to a XML data source with a single “line” of data":

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Config>
   3:  <UrlRoot>http://dapltp101.dmz.pri</UrlRoot>
   4:  <LoginUserName>asalvo</LoginUserName>
   5:  <LoginPassword>123456</LoginPassword>
   6: </Config>

 

This worked pretty good, except that when selecting UrlRoot from the drop down list of available options, it replaced the entire URL, and not just the URLRoot. I do like how they made the property grid “strong typed” in that it gives you the fields you defined for your data source, but I didn’t want to replace my whole URL. Also, I could not edit the value after selecting my XML data source value.

Looking at the format of ContextProperties in values, as well as how the data source was referenced, I decided to try typing what I wanted in myself. I went to the URL value and replaced the URL root with the name my XML data element, and this worked.

For example, given:

Type this in the value field for your URL in the Request object on the test: {{ConfigXml.Config.UrlRoot}}/Location1

Like I said, that took me a little while longer then I would have thought. I should have went with my gut and tried that format soon after getting the regular XML data source to work.

I do have one last issue (well the fist of many I am sure), and that is, I have two URL’s when I really should only have one. When I hit the root of my website, I am redirected to a https:// URL, and that is treated differently. I’d like to capture the redirected URL and use that so I don’t have to maintain two values in my configuration file, but I’m just gonna roll with it for now.

Monday, June 23, 2008 9:14:44 PM UTC  #    Comments [0] - Trackback
Programming
 Friday, June 20, 2008

Tonight was my first ever CodeFest event, physical or virtual (yes, there are virtual CodeFest’s being held via Second Life). The doors opened around 5pm, and I was there a little after that. There was an abundant supply of Papa John’s Pizza (+2 points) and free soda. Looking over the room, it’s pretty interesting to see all these laptops and power strips plugged in. Defiantly not something the fire inspector would approve of. Let’s hope I don’t have to break out the back window to escape a giant electrical fire.

Dave Bost and Larry Clarkin are our Microsoft hosts this evening, and they brought a boat load of prizes to give away. They also brought about 7 USB hard drives for people to copy the lab VM’s and labs for those who didn’t know, or didn’t bother to download stuff. With the exception of the labs, getting a VM provided to me is a bit to easy, so I decided to setup stuff myself. For the CodeFest tonight, I’m running on VMWare server 1.05, with a Win2k3 SP2 guest OS. I loaded up VS 2008 Team Suite, .Net Framework 3.5 beta 1, and SQL 2008 RC0 (I told you, I like a challenge). I’m rolling with Win2k3 for my guest because I only have 2 GB of ram on my laptop (note to self, hit up boss for 2 more GB of ram and reinstall server 2008), and windows server 2008 takes about 350MB more memory in my experience over Win2k3.

Linq and new Language Features

  • Automatic Properties: Define your property with an empty get and set (similar to an Interface declaration), and the compiler creates the backing variable for you.
  • Extension Methods
  • Object Initializers: Assign values to properties or fields in the “constructor” without having a constructor explicity defined
  • Collect Initializers
  • Anonymous Types: Combines Linq with Object Initializers to create new class definitions at run time based on the results returned from Linq.

Here is an example of Linq with an Object Initializer. The var we are creating is named contacts and is declared with var, as it’s not a strongly typed class. Notice that while there is a T-SQL feeling, the order of the expression is somewhat backwards with the from statement coming first (which I believe helps with intelli-sense among other things). The last line declares a new class (which you could call contact), that has two public properties, Name and Phone. “var” is not a dynamic declaration like it is in VB6, it is strongly typed, it just saves you the hassle of writing the type on the left side of the =. The compiler inspects the right side, and figures out what the type should be. You can mouse over “var” in VS, and it will tell you what type it is.

   1: var contacts = 
   2: from c in customers
   3: where c.State == "WA"
   4: select new {c.Name, c.Phone);


What you can’t see in the above code snippet (because I just typed it in manually), is that the auto formatting of the Linq statement in VS absolutely rocks, formatting the statement exactly the way I would have manually. It really makes the code more readable, and I can appreciate this little feature.

WPF

We pretty much jumped right into the lab/demo/code for WPF, so I didn’t take many notes, as you can see. The demo we were working on was pretty cool, it had some nice animations, graphics, etc. While we didn’t code all of the animations ourselves (copy/paste from the lab files), you can easily go in to the source and look to see how the designer (person) accomplished the various animations.

Conclusion

Overall I was very pleased with the CodeFest, and will defiantly be checking out the next one. I didn’t have any issues with my custom VM I put together, as the lab files were provided as stand alone downloads prior to the class.

Friday, June 20, 2008 2:12:26 AM UTC  #    Comments [0] - Trackback

Archive
<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Adam Salvo
Sign In
Statistics
Total Posts: 160
This Year: 86
This Month: 2
This Week: 0
Comments: 9
Themes
All Content © 2008, Adam Salvo
DasBlog theme 'Business' created by Christoph De Baene (delarou)