Repost: WCF CallbackContract with inherited interfaces -> bad prox

J

José Joye

---------------------
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/micr...read/thread/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();
}
}
 
S

sloan

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


José Joye said:
---------------------
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/micr...read/thread/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();
}
}
 
J

José Joye

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é


Nicholas Paldino said:
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.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


José Joye said:
---------------------
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/micr...read/thread/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();
}
}
 
J

José Joye

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é

sloan said:
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.







José Joye said:
---------------------
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/micr...read/thread/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();
}
}
 
N

Nicholas Paldino [.NET/C# MVP]

Curious, you realize the link has the same text that I exerpted for you
in my other reply, right?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

José Joye said:
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é

sloan said:
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.







José Joye said:
---------------------
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/micr...read/thread/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();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top