Web Service, Services & Endpoints - web-services

I am looking for clarification on the definitions of Web service(s) and endpoints.
I have always thought of web service and services as the same thing but I am not sure if this is correct. I have always thought of Endpoints are related to the resource they are retrieving and not whether it is a PUT/POST or whatever.
So with my understanding the following are two separate endpoints regardless if they are PUT, DELETE and so on:
/user/
/organization/
And as a collective the application is a Web Service.
I have seen others document each resource including the HTTP verb as a separate endpoint and that each resource is a web service and so a collection of the resources are web services like so.
Web Services (Web Service x2):
/user/
/organization/
Endpoints (two):
GET /user/
POST /user/
Is there a general clarification or standard that I am missing?
If not what is the common definitions of Endpoint, Web Service and Web Services
Cheers

Endpoints and webservices
You can understand endpoint as the URL where your service can be accessed by a client application. And a webservice can have multiple endpoints.
REST architectural style
Webservices can use the REST architectural style, which is protocol independent, but it's frequently designed over HTTP.
The REST architectural style was defined in the chapter 5 of Roy Thomas Fielding's dissertation. And the following set of constraints was added to this architecture:
Client-server
Stateless
Cache
Uniform interface
Layered system
Code-on-demand
The fundamental concept in a RESTful API is the resource. Resources can have different representations. For more details, this answer can be helpful.
REST over HTTP
Consider, for example, a webservice that exposes the following endpoints:
/messages: This endpoint identifies a collection of message resources.
/messages/{id}: This endpoint identifies a particular message resource.
Operations can be performed on the resources by performing HTTP requests to the endpoints using HTTP methods, as following:
GET /messages: Get all messages.
DELETE /messages: Delete all messages.
POST /messages: Create a new message.
GET /messages/{id}: Get a message using the identifier.
DELETE /messages/{id}: Delete a message using the identifier.
PUT /messages/{id}: Replace a message using the identifier.

Related

Types of web API's (web services)

Recently i have been doing some research about web services.
What i understand so far is that a web service is basically an API that communicates over HTTP.
There are Different kinds of web services:
SOAP web services (api that uses SOAP)
RESTful web services (api that uses The REST)
During my research those were the only ones mentioned except for one site. There they also mentioned:
XML-RPC
JSON-RPC
Are those also web services? And why aren't they mentioned?
If i said something wrong feel free to correct me.
Types of Web Services There are mainly two types of web services. SOAP
web services. RESTful web services.
-source: http://sfdcsrini.blogspot.com/2015/09/what-is-web-service-and-what-are.html
Broadly speaking, you're correct that there are two types of web service, but it's not SOAP vs. REST. It's RPC vs. ReST. There are other types of 'web' service which don't interact over HTTP, but they tend to be for specialist use cases these days so lets ignore them for now.
An RPC service is one where the API models some kind of abstract 'object' on which some defined set of 'methods' can be called - hence the name Remote Procedure Call. Any object defined in the API can have an arbitrary set of methods defined against them and HTTP is typically just used as a transport mechanism, with all the information required for the call to happen (object identifier, method name, call parameters) being serialised into a document which is transferred to the remote end via a POST operation and all objects are accessed via the same URI. Sometimes, query parameters on the URI are used to identify the object and/or method. SOAP and XML-RPC are both types of RPC implementation styles and are similar but not the same. JSON-RPC is another RPC mechanism, it just uses JSON to encode the RPC call rather than the more verbose XML.
ReST, on the other hand, is a resource oriented API style. In a ReSTful API the application communicates with 'resources' by transferring representations (i.e. serialised document formats) back and forth. Each resource has a consistent & well defined API and a unique address, called a URI. HTTP can then be used not just as a transport mechanism but, more importantly, also as an implementation of the API. So, the only way to interact with a resource in a ReSTful API is via one of the well-known HTTP methods - GET / PUT / POST / DELETE / PATCH. Not every API endpoint will implement every method but no endpoint will implement anything other than those methods.
The most important difference between the ReSTful approach and the RPC approach is what the data transferred means. In a ReSTful API the documents transferred represent the resource which the application wishes to manipulate whereas in an RPC the document transferred represents the method call which the caller wishes to make (or its response).
Two Type of API (Application Program Interface) was avilable.
That Was,
1)SOAP - Simple Object Access Protocol.
2)REST - Representational
State Transfer.

Soap Client consuming Rest Web Services

I am working on this project where the client only supports SOAP WSDL for consuming web services where as it supports rest for incoming calls. I need to Integrate this tool with another tool which is completely restful(has WADL). Is is possible for soap client to consume restful web services? If yes which tool will you all suggest?
No, it's not possible for a soap client to consume restful services. There is no interoperability between them whatsoever.
Even if you could do this you should not. Use a tooling library and just create a rest client for your rest service.
SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP. The standard protocol HTTP makes it easier for SOAP model to tunnel across firewalls and proxies without any modifications to the SOAP protocol.
REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique URI and a representation of the resource is returned. With each new resource representation, the client is said to transfer state. While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST and HEAD are the standard HTTP operations to be performed on that resource.
It can be done via jQuery.
jQuery sample for the Language Identifier :
$.post('https://services.open.xerox.com/RestOp/LanguageIdentifier/GetLanguageForString',
{'document' : 'This is a sample'}, function (data) {
var res = 'Not found';
if (data != null) {
res = data;
}
});
Further reading: https://spring.io/guides/gs/consuming-rest-jquery/

What is the difference between a Rest WS and Servlet

How do they differ in action? Servlet print html only?
Servlet :
--is a web component
--it's a powerful java technology
--managed by a container (namely web server such as tomcat) that generates dynamic content
--platform independent java classes (byte code)
--interacts with web clients as request response paradigm
--Request handling methods
****doGet,doPost,doDelete,doPut,doOptions,doHead,doTrace****
Rest WS (Representational State Transfer Web Service)
--A way to achieving service oriented architecture in web application
--it's an architectural concept
--web service resource is uniquely identifiable using URLS
--it has explicit relationship with HTTP methods namely GET,POST,PUT,DELETE
--highly re useable across the platform
A Rest WS is a service which you call, which returns data in a REST format.
A Servlet is a bit of UI that shows information to the user.
They are very different, although a Servlet could get the information that it displays from a Rest web service.

What are WSDL, SOAP and REST?

What is WSDL? How is it related to SOAP? Where does REST fit in all of that?
A WSDL is an XML document that describes a web service. It actually stands for Web Services Description Language.
SOAP is an XML-based protocol that lets you exchange info over a particular protocol (can be HTTP or SMTP, for example) between applications. It stands for Simple Object Access Protocol and uses XML for its messaging format to relay the information.
REST is an architectural style of networked systems and stands for Representational State Transfer. It's not a standard itself, but does use standards such as HTTP, URL, XML, etc.
Example: In a simple terms if you have a web service of calculator.
WSDL: WSDL tells about the functions that you can implement or exposed to the client. For example: add, delete, subtract and so on.
SOAP: Where as using SOAP you actually perform actions like doDelete(), doSubtract(), doAdd(). So SOAP and WSDL are apples and oranges. We should not compare them. They both have their own different functionality.
Why we use SOAP and WSDL: For platform independent data exchange.
EDIT: In a normal day to day life example:
WSDL: When we go to a restaurant we see the Menu Items, those are the WSDL's.
Proxy Classes: Now after seeing the Menu Items we make up our Mind (Process our mind on what to order): So, basically we make Proxy classes based on WSDL Document.
SOAP: Then when we actually order the food based on the Menu's: Meaning we use proxy classes to call upon the service methods which is done using SOAP. :)
Every time someone mentions SOAP/WSDL, I think of objects and classes defined in xml...
"You use SOAP just the same way that you would any PHP class. However, in this case the class does not exist in the local applications file system, but at a remote site accessed over http."
...
"If we think of using a SOAP service as just another PHP class then the WSDL document is a list of all the available class methods and properties. "
http://www.doublehops.com/2009/07/07/quick-tutorial-on-getting-started-with-soap-in-php/comment-page-1/
..and whenever someone talks about REST I think of HTTP's commands (request methods) like POST, GET and DELETE
SOAP -> SOAP(Simple object access protocal) is the application level protocal created for machine to machine interaction. Protocol defines standard rules. All the parties who are using the particular protocol should adhere to the protocol rules. Like TCP, It unwinds at transport layer, The SOAP protocol will be understood by Application layer( any application which supports SOAP - Axis2, .Net).
WSDL -> SOAP message consist of SoapEnevelope->SoapHeader and SoapBody. It doesn't define what would be message format? what are all the transports(HTTP,JMS) it supports? without this info, It is hard for any client who wants to consume the particular web service to construct the SOAP message. Even if they do, they won't be sure, it'll work all the time. WSDL is the rescue. WSDL (Web Service description Language) defines the operations, message formats and transport details for the SOAP message.
REST -> REST(Representational state transfer) is based on the Transport. Unlike SOAP which targets the actions, REST concerns more on the resources. REST locates the resources by using URL (example -http://{serverAddress}/employees/employeeNumber/12345) and it depends on the transport protocol( with HTTP - GET,POST, PUT, DELETE,...) for the actions to be performed on the resources. The REST service locates the resource based on the URL and perform the action based on the transport action verb. It is more of architectural style and conventions based.
You're not going to "simply" understand something complex.
WSDL is an XML-based language for describing a web service. It describes the messages, operations, and network transport information used by the service. These web services usually use SOAP, but may use other protocols.
A WSDL is readable by a program, and so may be used to generate all, or part of the client code necessary to call the web service. This is what it means to call SOAP-based web services "self-describing".
REST is not related to WSDL at all.
SOAP stands for Simple (sic) Object Access Protocol. It was intended to be a way to do Remote Procedure Calls to remote objects by sending XML over HTTP.
WSDL is Web Service Description Language. A request ending in '.wsdl' to an endpoint will result in an XML message describing request and response that a use can expect. It descibes the contract between service & client.
REST uses HTTP to send messages to services.
SOAP is a spec, REST is a style.
Wikipedia says "The Web Services Description Language is an XML-based language that provides a model for describing Web services". Put another way, WSDL is to a web service, as javadoc is to a java library.
The really sweet thing about WSDL, though, is that software can generate a client and server using WSDL.
Some clear explanations (for SOAP and WSDL) can be found here as well.
Difference between a SOAP message and a WSDL?
REST is light-weight in terms of encoding, much more useful for light weight devices i.e. non strict APIs.
REST is format independent. XML, HTML, JSON all options are available.
REST provides abilities for on 2 point message transfer (not surprising since REST stands for REpresentational State Transfer) where WSDL/SOAP interaction is multiple point message interaction.
REST does not require a new extension for XML messages, where in WSDL/SOAP this is the case.
WSDL/SOAP uses multiple transport protocols, REST relies on only HTTP. Therefore WSDL/SOAP can be used like a RESTful way, however simple requests can be overly complicated/heavy weighted.
A simple analogy: REST is like a motoboy delivers your food easy and quick. XML extended WSDL/SOAP more like UPS delivery, more structured and serious stuff but comes with a cost.
A WSDL document describes a webservice. It specifies the location of the service and the methods of the service using these major elements:
data types using in webservice
data elements for each operation
describe the operations that can be performed and the messages envolved
SOAP (Simple Object Access Protocol) is a messaging protocol that allows programs that run on disparate operating systems to communicate using http and xml.

What's the difference between WSDL,DISCO and EVENT?

All of them are web services, but what's the difference?
WSDL (Web Service Description Language) is a standard notatation for describing a Web Service in xml.
DISCO is a tool for querying SOAP and similar services and extracting useful information from the WSDL provied.
EVENTs is a proposed standard which uses WSDL and extends WSDL to support publish subcribe type event driven processes.
WSDL:
WSDL is a markup language that describes the web service. In order to use this Web service, the Client application developers need to know the methods exposed by the Web service and the parameters to be passed to these methods. It is imperative that access to these methodologies is available at development time and it is just this need that WSDL addresses.
DISCO:
The Web Service Discovery Tool (DISCO) is used to discover the URLs of XML Web Services located on a Web server and saves documents related to each XML service on a local disk. The DISCO takes the URL and discovers and produce publishes discovery documents (.wsdl, .xsd, .disco and .dicomap files) as arguments. Some of the options available for use with this tool are:
/d[omain]:domain - Specifies the domain name to use when connecting to a proxy server that requires authentication
/nosave - Does not save the discovered document or results
/nologo - Suppresses the Microsoft startup banner display
/o[ut]:directoryName - Specifies the output directory in which to save the discovered documents. Current directory is the default one.
/p[assword]:password - Specifies the password to use when connecting to a proxy server
/proxy:url - Specifies the URL of the proxy server to use for HTTP requests.
DISCO is a tool, not a web service itself.
EVENT:
if you mean to WS-Eventing, see here.
UDDI- UDDI is a central directory. It will have web services listed from multiple domain and servers.
DISCO- Disco contain web services listed from one domain and server.By which particular web service can be selected.
WSDL- It describe the rules or grammar for the function that are exposed in the web services.