문제

Actually there should be a straight forward answer to this question (is about the "Object" property below):

Having the following data contract:

    [KnownType(typeof(bool))]
    [KnownType(typeof(int))]
    [KnownType(typeof(string))]
    [KnownType(typeof(Customer))]
    [KnownType(typeof(Client))]
    public class Transaction
    {    
        // properties
        [DataMember(Name = "UID")]
        public int UID{}

        [DataMember(Name = "Type")]
        public Enums.TransactionType Type{}

        [DataMember(Name = "Data")]
        public Object Data{}
    }

and the following service contract:

public interface IService
{
      [OperationContract(Name = "GetData")]
      List<Transaction> GetTransact();
}

Will this be interoperable? Saying from Java, gSoap? If not, how can I make it interoperable?

Thank you.

EDIT: I just want to know if WCF knows how to serialize/deserialize the Object from/into the known types defined.

도움이 되었습니까?

해결책

It should be fine as long as the client can generate the types properly from the WSDL. For example depending on the client, it might change C#'s List<Transaction> into a Transaction[] or something fairly equivalent. You will also need to select the right binding type. Usually basicHttpBinding has the best results for interoperability.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top