Use a Rest service or a Web service?

0
Hi, I have created a PHP page where I can insert text into some inputfields and I wanted to send these data to my Mendix app to create a object with this data. What is the best way to do this? I have red something in the documentation about Rest and web services, but I can't really figure out what to do with it. Does somebody have a good idea for this issue?  Thank you in advance!
asked
3 answers
4

Short answer: depending on the situation. But for this I would use REST, because it is easy to interoperate, configure and secure.

Explanation:

As you know their are lots of technologies available that allow you to create services which can be consumed by different client, the client can be web application, window application, mobile application, etc. Services can be http enabled or support multiple protocols.

As you know today we will discuss only about the WCF and Web API.

WCF stands for Windows Communication Foundation, created by Microsoft with .NET Framework 3.0. It provides us a platform where we can build secure, reliable service that can integrate across the platforms and interoperate smoothly.

Web API is also a framework that is used to make HTTP services. As you know, now a days we are using mobiles, tablets, apps and different types of services, so Web API is a simple and reliable platform to create HTTP enabled services that can reach wide range of clients. It is used to create complete REST services.

Web API or WCF

So, let's start the race between Web API and WCF and see at the last that who is the winner.

SOAP

Simple Object Access Protocol [SOAP] is a protocol invented by Microsoft that is used to create a structured format data or message that can transfer over the internet. SOAP protocol is the main foundation of WCF and uses XML format. Web Service creates WSDL [Web Services Description Language] file which provides the information about the service data, so WSDL file is used by the client to understand the methods available on the service.

REST

REST stands for Representational State Transfer. It is not a protocol like SOAP whether it is architecture design pattern that is used for building and creating Web Services.

Web API used this pattern to build web services. Basically Web API is a resource driven architecture that exposes endpoint to the client. Web API is fully REST supported. It uses GET, PUT, POST, DELETE verbs to communicate with the clients.

Interoperability

RESTful services like Web API are simple and light weight and easy to access by any client which supports HTTP calls. It is not like to SOAP where client need to understand WSDL to implement the service.

WSDL uses some extra configuration and require some additional logic that might not be available on many devices such as phones, smart TVs, Tablets, etc.

As WCF supports many protocol so it can consumed by lots of client that are using different protocol such as TCP, MSMQ, etc. not only HTTP protocol to access service.

Interoperability

Configuration Overhead

Client needs to make more configurations as compared to Web API to access WCF Service. WCF uses more configurations such as endpoints, behaviors, etc to expose the service. But Web API has more standard way to customize the service which helps it to reach more clients.

Speed

As RESTful services use HTTP protocol to access client and HTTP request/response are smaller than a SOAP request, so Web API is the best choice if you are going to create a service for low bandwidth devices or mobile devices to access client. HTTP request/response is also more readable as compared to SOAP because it contains header, body, etc. which makes it complex.

Security

WCF service provides us high level security framework which provide enterprise level security. It uses WS-I standard to provide secure service.

But Web API uses web standard security such as basic authentication, token authentication and for more complex such as OAuth; Web API provides more flexibility. Then use SOAP when you are going to authenticate with external services such as google, facebook, etc.

answered
1

Hi Atze,

Creating a webservice is (comparing to rest) the quickest way to integrate with another app. By following this link you get an how-to create webservices. 

answered
0

Hi Atze,

A REST service is a type of web service, along with SOAP. Either way, you're just enabling a way to make HTTP requests and responses between two or more systems.

In this case, you probably want to expose a REST service that listens to a form POST. In this way, your PHP page can probably POST a form with fields directly to your Mendix app. Here's a blog post that covers exposing that service using Mendix.

Hope that helps!

answered