1

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.

user995099
  • 129
  • 1
  • 3
  • 12

3 Answers3

1

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.

Mutant
  • 3,663
  • 4
  • 33
  • 53
0

YES !

WCF serializes everything into an XML message, defined by a XML schema (XSD) file.

So as long as your client on the other end can understand and interpret XSD and WSDL files (for SOAP-based WCF services), then YES - that client will be able to read your data.

That's the whole point of WCF - it's the most interoperable web services standard around and any halfway decent client can talk to it...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
0

Depends on the Bindings you define, not on the contract. Worst case would be, that you have to define another binding for SOAP, JSON or any other compatible technology. Ie. WS-HTTP won't work.

MADMap
  • 3,132
  • 3
  • 25
  • 31
  • What do you mean by "WS-HTTP won't work" ?? That depends on the client - if it's a Java app, it might well speak WS-HTTP. A mobile device probably won't. ... but that's not a WCF problem - it's a question of the capabilities of the client (device) – marc_s Nov 14 '11 at 12:27