Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

Repost: WCF CallbackContract with inherited interfaces -> bad prox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
José Joye - 10 Jan 2008 16:20 GMT
---------------------
This question has already been posted. I got a tip to use
[NetDataContractSerializer] and also get rid of svcutil.exe. However, I
still want to understand why it does not work the "official" way.
previous post:
http://groups.google.com/group/microsoft.public.dotnet.general/browse_thread/thr
ead/e81b70937d456898/f2123e0375500a9b


I tried to post it another time. But it seems not to appear in newsgroup
(seems to be related to my attachement???)
---------------------

I'm protyping an application with WCF and I'm trying to define a Callback
Contract with an interface that derives from another one.
Doing so, the generated proxy code (using svcutil.exe) does not see the base
interface and a "NotSupportedException" is thrown on the Server when trying
to call methods defined in base interface.
I have also tried to manually define the base interface in the proxy class
so as to be able to implement the methods in the client -> Same behavior.

Does anyone knows why it does not work?

Thanks for any help and sorry for the repost!
José

Here is my contract definition :

namespace wcfContract
{

[ServiceContract(Namespace = "Test")]
public interface IPing
{
[OperationContract]
void Ping();
}

public interface ITestCallback : IPing       <-------------- IPing method
not seen  at all in proxy
{
[OperationContract]
void TestCB();
}

[ServiceContract(Namespace = "Test", CallbackContract =
typeof(ITestCallback))]
public interface ITest : IPing
{
[OperationContract]
void Test();
}
}
sloan - 10 Jan 2008 16:42 GMT
Jose,

I notice you keep coming up empty on this request.

Try
http://forums.microsoft.com/msdn/showforum.aspx?forumid=118&siteid=1

or
microsoft.public.windows.developer.winfx.indigo

I think the forum is your best bet.

That's such a specific wcf question...that the forums is probably your best
shot.

Then let me know me what you find! (by posting back here I guess).
I'm curious as well, just not as  curious as you are. (Well, not enough time
to check it).

Good luck.

> ---------------------
> This question has already been posted. I got a tip to use
[quoted text clipped - 49 lines]
> }
> }
José Joye - 11 Jan 2008 08:52 GMT
Sloan,
Thanks for your link for the newgroup.
I have finally found a link that explain how I could do this:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=781855&SiteID=1

- José

> Jose,
>
[quoted text clipped - 71 lines]
>> }
>> }
Nicholas Paldino [.NET/C# MVP] - 11 Jan 2008 18:13 GMT
Curious, you realize the link has the same text that I exerpted for you
in my other reply, right?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Sloan,
> Thanks for your link for the newgroup.
[quoted text clipped - 81 lines]
>>> }
>>> }
Nicholas Paldino [.NET/C# MVP] - 10 Jan 2008 16:44 GMT
Jose,

   This is the third time you have posted this.  Reposting in this manner
isn't going to make the answer come any faster.  On top of that, people are
going to see it, and probably start to intentionally ignore it.

   As for your particular issue, it's just not supported.  Brian McNamara
[MSFT] says:
We struggled with the tension of finding a programming model that was easy
to understand, and one that 'worked' without unexpected consequences. There
are lots of unusual edge cases that come about about as a result of multiple
inheritance which cause problems with many of the 'simple' approaches.
Here's one example. Suppose you have

[ServiceContract(Namespace="foo", CallbackContract=typeof(IBaseCB))]
interface IBaseC { ... }

interface IBaseCB : IBaseBaseCB { ... }

interface IBaseBaseCB { [OperationContract] void F(); }

Now if I create an endpoint of type IBaseC and allow reflection to walk up
both hierarchies, I'll end up with a callback operation F() in the contract
whose namespace is "foo".

Now suppose I write

[ServiceContract(Namespace="bar", CallbackContract=typeof(IBaseBaseCB))]
interface IOther { ... }

An endpoint of IOther has callback operation F() in namespace "bar". Now
suppose I do

interface IDerivedCB : IBaseCB { ...}

[ServiceContract(CallbackContract=typeof(IDerivedCB))]
interface IDerivedC : IBaseC, IOther { ... }

What is the namespace of operation F() of an endpoint of type IDerivedC?
There's no good solution; with IBaseC and IOther one has created contracts
which cannot reasonably be composed together.

In order to try to avoid most of these weird edge cases, we tried to keep
the model very constrained and simple. In general, when working with duplex
contracts, it is good to always define and refine the ServiceContract and
CallbackContract interfaces together; think of them as a single entity that
happens to be spread across two CLR interfaces. The [SC] is the
"authoritative" interface when it comes to getting info from attributes and
walking the inheritance hierarchy, while the CC is just an auxiliary
interface attached to a particular SC.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> ---------------------
> This question has already been posted. I got a tip to use
[quoted text clipped - 49 lines]
> }
> }
José Joye - 10 Jan 2008 16:58 GMT
Nicholas,
Sorry for spamming the newsgroups. This was not my intention at all.
From my PC, I was not able to see my repost (even searching within google).
I guess this is a problem with our proxy/network...???

Any way, thanks for replying!
- José

> Jose,
>
[quoted text clipped - 100 lines]
> > }
> > }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.