Did you know that Visual Studio includes a WCF Test Client? No? It’s very useful for testing out various services, especially SOAP ones. RESTful services are much easier to test as you just need a browser, but SOAP requires some sort of client.

Browse to the following path (note, this is Visual Studio 2013, adjust the 12.0 to whatever version you have):

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Once you’re there look for the icon shown in figure 1.

Figure 01: WCFTestClient.ext Icon
Figure 01: WCFTestClient.ext Icon

Now, while this is a useful tool, it’s so unintuitive, it’s not funny. One of the stumbling points has to do with Arrays so let’s look at this example.

Fun With Arrays

Connect to a service, and you’re given a tree-view of the methods that you can call on the service. So far, so good. If you click on a method, then you’re given the opportunity to add test values and then execute it to get the result. But wait, what do we have here? Our service takes an array of ints, what’s this weird length=0 stuff. Oh, of course we don’t have any items yet (Figure 02).

Figure 02: The Curious Length
Figure 02: The Curious Length

So let’s see here. What happens if we select the length. Hmmm, a drop-down, good… Awww, it’s a drop-down to null (Figure 03).

Figure 03: Drop Down to Null
Figure 03: Drop Down to Null

Hmm, ok. Well, I just want to pass a single int anyway, what happens if I enter a 1 in the box. D’oh! Error. (Figure 04).

Figure 04: Entering a Value Error
Figure 04: Entering a Value Error

Ok, so that doesn’t work either. What am I to do to get this work? So intuitive, right!? Well, if you hadn’t guessed it, we need to change the text length=0 to length=1. Now we get a little arrow next to the Attribute name (Figure 05).

Figure 05: We’re Getting Somewhere Now!
Figure 05: We’re Getting Somewhere Now!

Now, if you expand out the attribute, you’ll see you have a place to enter your values. Sweet! (Figure 06)

Figure 06: Success!
Figure 06: Success!

Conclusion

I’m not the first one to stumble on this, and I’m sure I won’t be the last. I ended up finding other posts on the topic, but I figured another one on the web couldn’t hurt. Hopefully this saves you from banging your head against a wall the next time you use the “Ultra Intuitive” WCF Test Client.