Reputation: 129
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.
Upvotes: 1
Views: 2991
Reputation: 3821
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.
Upvotes: 1
Reputation: 3192
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.
Upvotes: 0
Reputation: 755073
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...
Upvotes: 0