Question

I've read quite a few articles regarding the differences between REST and SOAP. I will just summarize in a few lines, please let me know if its wrong.

  1. SOAP is a protocol which uses HTTP, TCP etc to transfer the messages but REST uses only HTTP to transfer messages.

  2. SOAP transfers the messages in XML format only but REST uses JSON or XML.

  3. REST doesn't involve the same traffic overhead as SOAP (as SOAP involves the complex XML WSDL generation).

I've read that WCF was developed to provide interoperability. I have developed REST services in .net and the client was a mobile device (not a .net client). This one I have tested and gone live as well.

Having said that, my question is ...

Has anyone developed basichttpbinding WCF service and provided this to a non .net client like Java, mobile devices etc to make it interoperable? Is it possible for non .net clients to consume WCF other than REST?

Was it helpful?

Solution

Yes, you can consume a WCF service with any kind of SOAP or REST client.

SOAP is a protocol which uses HTTP, TCP etc to transfer the messages but REST uses only HTTP to transfer messages.

This is too broad to answer with either Yes or No. Strictly related to your question, we have this characteristics for SOAP:

  • SOAP is a protocol;
  • SOAP messages can be sent over HTTP, TCP, SMTP etc (any protocol actually). SOAP is a messaging protocol used on top of another transport protocol;
  • most used protocols for SOAP are HTTP and HTTPS;

Now the characteristics for REST:

  • REST is an architectural style of building applications;
  • REST is not actually bound to the HTTP protocol, it can use any transport protocol;
  • Everybody does REST with HTTP and HTTPS;

SOAP transfers the messages in XML format only but REST uses JSON or XML.

SOAP can only send XML messages, it's part of the protocol. You actually need to use a specific format for the XML with Envelope, Header and Body tags.

REST is about representations of resources. The representation can have any structure and can be in any format, not just XML or JSON (although XML and JSON are the most used);

REST doesn't involve the same traffic overhead as SOAP (as SOAP involves the complex XML WSDL generation).

WSDL is not involved in the actual call of operations, it's something separate to describe the SOAP web service. REST has something similar (although not very used) called WADL. You need to marshall/unmarshall your data with both SOAP and REST so the overhead is most of the time not an issue (the SOAP envelope is not that big).

Has anyone developed basichttpbinding WCF service and provided this to a non .net client like Java, mobile devices etc to make it interoperable? Is it possible for non .net clients to consume WCF other than REST?

That's the idea with web services (SOAP or RESTful), to be called from any kind of clients. It's a method of communications between two machines. The implementation of the machines does not matter (Java, C#, PHP, Python etc).

WCF is a web service framework that can expose the service as both SOAP or REST API. It can be called from any kind of client.

OTHER TIPS

I think you misunderstood some basic points.

  1. Both REST and SOAP are web service protocols playing over HTTP. I think that you should not care about HTTP, TCP or UDP, because they are protocols of lower level...

  2. SOAP wraps everything inside an XML envelope which imposes some traffic overhead. This is why SOAP is considered worse in performance but more formal and therefore more suitable for certain uses.

  3. Both SOAP and REST are independent of the platform they are implemented

Therefore, yes you could consume a REST or a SOAP service implemented on .NET, with any kind of REST or SOAP client. You should also know that you could implement your web service functionality using WCF and change the endpoint between SOAP and REST just by changing some configuration options .

Hope I helped!

Yes it is possible to use WCF services other than Rest for non .net Clients. WCF basically allows you to create web service . The purpose of web service is that it provides cross platform functionality.

Rest and Soap both are web services but with different purposes. It depends upon your requirement which one you want to use. Rest only works on http protocol and can be easily called through URI and can also perform CRUD operations through URL. It can also be called from web browsers.

However soap also supports cross platform communication but the client that want to use soap must have a support of soap toolkit. It can not be called from browser. Almost every languages nowadays support SOAP api.

The service that you expose with basichttpbinding is soap based service and yes it can also be called from non .net clients.

Go with web apis instead of wcf services for rest approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top