Featured Post

Change Group Policy – How To Change Screen Save Time Out in Regi

Before I start this post let me say that if you follow what I’ve outlined below and it doesn’t work, don’t call me! I did this to my virtual machine and it “works on my machine”.  My virtual machine is managed by group policy at work.  Every 5 minutes the screen locks and I have to log back...

Read More

Generating WCF Proxy Class with Proper Namespace

Posted by Keith Elder | Posted in WCF | Posted on 16-08-2007

1

Since I wanted to move my generated proxy class generated by svcUtil to a separate C# Class Library project I ran into another problem after I figured out how to generate the collection type I wanted.  The problem I ran into was the namespace wasn’t correct.  At first there wasn’t a namespace.  I knew there was a namespace switch in the svcUtil.exe but the lack of documentation on it and examples left me scratching my head a few times.  Why people don’t include examples of every single switch is beyond me.  I guess I am too much of an educator to understand why simple things like that go undocumented. 

The namespace declared for the data contract in the WSDL was something like http://My.Namespace/ and  I wanted it to map to My.Proxy.  Here is the switch for svcUtil that gave me what I wanted.

svcUtil /n:http://My.Namespace/,My.Proxy

Of course combine this with the post from yesterday where I mapped the collection type of List<> and we are on our way to creating a pretty good proxy for the service.