Pingpong
Pingpong

Reputation: 8019

WCF service callable by other platform, and abstract class compatibility

I want to find out whether or not WCF service is platform independent. That is, can WCF service receive requests from other platform, like Java? If it can, Does abstract class in WCF work for other platform. For example, can the code below work for other platform?

-- This is only example

[ServiceContract(Name = "Service1")]
public interface IService1
{                
    [OperationContract]
    [ServiceKnownType(typeof(Retangle))]
    [ServiceKnownType(typeof(Square))]
    string GetShape(Shape shape);
}

    [DataContract]
    public abstract class Shape //is abstract interoperable by other language
   {    
    }

 [DataContract]
   public class Retangle:Shape
    {    
    }

[DataContract]
public class Square : Shape
{    
}

http://localhost:10287/Service1.svc

Thanks

Upvotes: 1

Views: 312

Answers (1)

softveda
softveda

Reputation: 11074

A Qualified Yes, WCF if used with standard transport and message protocols like SOAP, JSON, REST, HTTP/S is highly interoperable with other platforms and languages. In practice the compatibility will vary depending on the language and platform as also the level of WS-* protocols being used if you are using SOAP.
In your specific case using KnownType works with Java and I can vouch for it as we use it in our enterprise WCF app consumed by a Java client. The Java stack we have used is Metro and the IDE is Netbeans.

You can always try with SoapUI which is a generic SOAP client written in Java to consume your WCF service and test if it works.

Upvotes: 2

Related Questions