在Java或.NET非WCF的客户端工作DataContract? [英] Is WCF DataContract work in java or non .net clients?

查看:115
本文介绍了在Java或.NET非WCF的客户端工作DataContract?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发将由非.NET客户端(如Java客户端)所消耗的WCF服务(basicHttpBinding的)。但是现在我不知道,是DataContract将在安装插件和其他非.NET客户端支持?如果不是shuold是我的返回类型。基本上我的服务将由非.NET客户端使用的,我不知道是否DataContract非.NET客户端支持。<​​/ P>

下面是我的合同和服务合同code。

  [DataContract]
公共类DataResponse
    {
        字符串客户ID;
        字符串版本;
        字符串电子邮件;
        字符串的firstName;    [数据成员]
 公共字符串客户ID
        {
            {返回客户ID; }
            集合{客户ID =价值; }
        }    [数据成员]
        公共字符串版本
        {
            {返回版本; }
            集合{版本=价值; }
        }[数据成员]
        公共字符串的电子邮件
        {
            {返回电子邮件; }
            集合{电子邮件=价值; }
        }    [数据成员]
        公共字符串名字
        {
            {返回的firstName; }
            集合{=的firstName价值; }
        }
}[服务合同]
    公共接口ICustomerProfile
    {
        [OperationContract的]
        DataResponse GetCustomerProfile(字符串requestObj);
    }

请做要紧。


解决方案

是的,它会工作。

这里是例子 - http://adventuresinsoftware.com/blog/?p=481

您可以按照示例中的步骤操作,并你们的。

I am developing a wcf service (basicHttpBinding) that will be consumed by non .net clients (e.g. Java clients). But now I wonder, is DataContract will support in jave and other non .net clients? If not what shuold be my return type. Basically my service will be consumed by non .net clients and I don’t know whether DataContract supports in non .net clients.

Below is my contract and service contract code.

[DataContract]
public class DataResponse
    {
        string customerId;
        string version;
        string email;
        string firstName;

    [DataMember]
 public string CustomerId
        {
            get { return customerId; }
            set { customerId = value; }
        }

    [DataMember]
        public string Version
        {
            get { return version; }
            set { version = value; }
        }

[DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

    [DataMember]
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }
}

[ServiceContract]
    public interface ICustomerProfile
    {
        [OperationContract]
        DataResponse GetCustomerProfile(string requestObj);
    }

Please do the needful.

解决方案

YES, it will work.

here is the example - http://adventuresinsoftware.com/blog/?p=481

you can follow the steps given in example and try yours.

这篇关于在Java或.NET非WCF的客户端工作DataContract?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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