WCF - 对象作为已知类型 - >互操作? [英] WCF - Object as known type -> interoperable?

查看:122
本文介绍了WCF - 对象作为已知类型 - >互操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实应该有一个直截了当的回答这个问题(是关于下面的对象属性):

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

具有下列数据契约:

    [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{}
    }

和以下服务合同:

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



这会不会是可互操作的?从Java,gSOAP的意思吗?如果没有,我怎么可以让它互通

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

感谢您

编辑:
我只是想知道,如果WCF知道如何序列化/从/反序列化对象到定义的已知类型。

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

推荐答案

应该只要客户端可以从WSDL正确生成的种类被罚款。对于具体取决于客户端的例子,它可能会改变C#的列表<交易> 交易[] 或东西相当相当的。您还需要选择合适的绑定类型。通常basicHttpBinding的具有互操作性的最好成绩。

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.

这篇关于WCF - 对象作为已知类型 - &GT;互操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆