Last post Jul 31, 2008 07:33 PM by jon.ebersole
Jul 31, 2008 07:33 PM|jon.ebersole|LINK
Please let me know if I have posted in the wrong area.
I am working with WCF Services for the first time. I have a windows based project using WPF, my WCF Service, and a common set of classes in a class library. I have the common class library as references in both my WPF windows project and also as a reference
in WCF service running on a website (in IIS 7). I added my WCF service as a service reference to my windows project so I could use it. My WCF Service says that it accepts an object from my shared class library, and then returns an object from my shared class
My problem is that when you add the service reference to the windows project, the service name that you create for that service reference gets lodged in the namespace hierachy. I am assuming that my WCF service will return objects that are typed by the
classes in my shared class library, but they aren't. Here is an example;
I have a function in my WCF Service called GetValue. I have a class called Test in a namespace called MyCompany in my shared library and I make this as the parameter to my WCF Service and also the type being returned.
The WCF Service would look something like this...
Then, in my WPF project I add that WCF Service to my project and during this step I name it TestService. When I instantiate the service it looks like this...
Dim oService as MyCompany.TestService
Then, I call...
Dim oOldTest as MyCompany.Test
Dim oNewTest as MyCompany.Test
oNewTest = oService.GetValue(oOldTest)
On the last line, it gives an error stating that the value returned from the service is of type MyCompany.TestService.Test and cannot be converted to MyCompany.Test
It injects the service name. I know from previously working with normal webservices, I could just go into the Reference.vb file under the webservice reference and make the necessary changes, and convert the namespaces to what I wanted them
to be from the autogenerated code when it created the webservice reference. Anytime I make changes to the webservice, I would update the reference, and then have to manually edit that file again to fix the class typing to make it work. There has to be a
better way. I'm finally getting around to finding the *Right* way to do this. Can someone point me in the right direction? I've exhausted all research at this point. Any help would be greatly appreciated. Thanks in advance.