Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can one WCF Service return another?

Tags:

c#

wcf

For example, could a WCF Service act as a factory for other WCF Services ? E.g.:

[ServiceContract(Namespace = "Foo")]
interface IThing
{
    [OperationContract]
    void DoSomething();
}

[ServiceContract(Namespace = "Foo")]
interface IMakeThings
{
    [OperationContract]
    IThing Create(string initializationData);
}

Similarly can an interface take another interface as a parameter ?

[ServiceContract(Namespace = "Foo")]
interface IUseThings
{
    [OperationContract]
    void UseThing(IThing target);
}

Would this require adjusting known types ?

All the interfaces would be defined up front and known to both the client and the service.

like image 858
WaffleSouffle Avatar asked Feb 20 '23 07:02

WaffleSouffle


1 Answers

  1. No. When you're going over the web you're not dealing with references like you might in C# so you won't be able to return an object that is not serializable. Even then, only the data that is marked as DataMember will come across.

  2. Yes. You would have to adjust known types, but again, that would be an interface to a DataContract not an OperationContract

like image 122
Thinking Sites Avatar answered Mar 03 '23 10:03

Thinking Sites