I've been testing a RESTful webservices for the last little while using SoapUI. It's worked great until this week where a requirement was added that the web service must use Kerberos authentication, which SoapUI does not seem to be able to handle.

Although I plan on getting my regression test completely automated using .NET, I still have a little bit more to learn before that becomes a viable option.

I've been spending a little bit of time with wfetch although was hoping that I could find a way to queue up requests or run them in order (I know that I may not be able to have my cake and eat it too).

Any recommendations?

1 Answer 1


Kerberos authentication can be really, really narky. What I found to solve the "run test as user x in .net" problem I needed to perform a two step process.

Step 1: Fire up the process I want to test as the alternate user.
Step 2: Use impersonation on the call to allow my test harness to access the process from the other user.

This was done for IE in WatiN, but I am guessing that the code will be similar, just calling your chosen test exe.

using System;
using System.Configuration;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Security;
using System.Net;
using System.Security.Principal;
using System.Reflection;
using System.IO;

 public static void SetAlternateUser(string userName, string password, string domain)
        // thread safe singleton code
        lock (threadSafeLock)
            if (_ie == null)

            _ie = null;

            // fill the NetworkCredeitials object that we use for impersonation
            if (string.IsNullOrEmpty(domain))
                alternateUserCredentials = new NetworkCredential(userName, password);
                alternateUserCredentials = new NetworkCredential(userName, password, domain);

            // Prepare to launch
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.UserName = userName;
            psi.Password = SecurePassword(password);
            if (!string.IsNullOrEmpty(domain))
                psi.Domain = domain;
            psi.UseShellExecute = false;
            psi.LoadUserProfile = true;
            psi.FileName = "c:\\Program Files\\Internet Explorer\\iexplore.exe";
            psi.Arguments = "about:blank";

            // launch
            Process proc = new Process();
            proc.StartInfo = psi;

            // Time to become an imposter
            hToken = IntPtr.Zero;
            hTokenDuplicate = IntPtr.Zero;

            if (Win32.LogonUser(alternateUserCredentials.UserName, alternateUserCredentials.Domain, alternateUserCredentials.Password, 2 /*LOGON32_LOGON_INTERACTIVE*/, 0 /*LOGON32_PROVIDER_DEFAULT*/, out hToken))
                if (Win32.DuplicateToken(hToken, 2, out hTokenDuplicate))
                    windowsIdentity = new WindowsIdentity(hTokenDuplicate);
                    impersonationContext = windowsIdentity.Impersonate();

                    _ie = IE.AttachToIE(Find.ByUrl("about:blank"));

  • Is "narky" a technical term? I'm unfamiliar with it. ;-) Commented Jun 30, 2011 at 17:05
  • Cool. This looks helpful. I probably won't get around to trying it until this weekend though. Commented Jun 30, 2011 at 18:45
  • Although I see a lot of potential for it in the future, this doens't seem to help me out as I am attempting to impersonate myself. the main problem being that IE and soapUI don't seem to authenticate properly. Commented Jul 7, 2011 at 3:52
  • Ended up doing some more work with this, and never could get it to work with SoapUI, but I did find that this worked well with a similar tool that we ended up putting together for testing. Commented Jan 3, 2012 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.