views:

65

answers:

1

My service uses a type Foo defined in another DLL, and my client also uses that DLL to get that type. Rather than generating a proxy class for that type, I'd like the proxy code to just refer to the real type. I can accomplish this manually by generating the proxy with WSDL.EXE on the running service, manually editing out the partial class Foo definition from it, and adding a Using statement. I'd like to do it without hand-editing if possible.

It seems like maybe the answer is to use SVCUTIL.EXE instead of WSDL.EXE. There are two intriguing options: /R and /ET. I tried putting /ET:Foo and /ET:My.FQN.Util.Foo, and /ET:www.my.com.the.servicenamespace.Foo, and also adding the DLL filename to the option. But nothing changes in the ServiceWithFoos.cs proxy class that gets created. The partial class definition for Foo is still there.

Am I on the right track? What am I doing wrong?

A: 

Add [DataContract(Namespace = "http://anything.here")] to your Foo type, then use svcutil with the /r option taking the path of the library containing Foo. This way svcutil should see the same contract namespace and map Foo correctly.

Julien Lebosquain
This did not quite work. Unfortunately, this site will not allow me to post the error message! I've been trying all kinds of things for the last 30 minutes, but it always rejects my inputs. The submission button greys out when I click it. There are URLs involved in the error message - probably Stackoverflow thinks I am trying to hack it.
cstacy