So I have a situation like this: A needs to call B service and A gets to know only B address and only at runtime. But both have same service contract in advance.
So far I have this (at A):
using (ChannelFactory<IService1> scf = new ChannelFactory<IService1>(new BasicHttpBinding(), "B's adress"))
{
var channel = scf.CreateChannel();
channel.GetData(5);
...
}
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
}
[DataContract]
public class CompositeType
{
[DataMember]
public bool BoolValue
...
[DataMember]
public string StringValue
...
}
B exposes same service contract.
Now the question. With GetData everything works fine, but with GetDataUsingDataContract which takes and returns composite type – it seems that B receives object with default values and not what has been sent. What could be wrong?
Put
CompositeTypeinto an assembly C and reference that in A and B.