Web Services
Talend ESB helps you to create new web services or to service-enable your existing applications and interfaces for use with the Web, using technologies based on Apache CXF.
- the Java API for XML Web Services (JAX-WS)
- the Java API for RESTful Web Services (REST)
There are three main styles of web services development available with CXF:
-
Contract-first development:
Another JAX-WS option, this time a WSDL (Web Services Description Language) file is used to define the operations and types a web service provides. This file is often referred to as the web services contract, and in order to communicate with a web service, you must satisfy the contract. Contract-first development involves starting out by writing a WSDL file (either by hand or with the help of tooling), and then generating stub Java class implementations from the WSDL file by using tools such as those provided by CXF.
-
Code-first development:
Used in JAX-WS development, here we start out with a Java class and then let the web service framework handle the job of generating a WSDL contract for you. This method is somewhat easier for newcomers to web services, as it avoids the need to construct a WSDL, however as you start to add security policies to your web services you'll probably find direct modification of an existing WSDL contract easier. Note you can also start with code to generate a WSDL and then modify that WSDL using the contract-first approach, see this article for more details.
-
JAX-RS (REST) services:
REST is a more recent paradigm for simpler HTTP-based services which takes advantage of HTTP verbs (GET, POST, PUT, DELETE), an intuitively designed http URL string, and (in some cases) HTTP message body for responses and requests. It's paradigm is so simple that frequently usage of a web browser alone is sufficient to make and receive REST calls, however REST is not yet up to the level of providing the advanced WS-* support (security and reliability) available with JAX-WS.
We look at how to do development using these models in Contract-first development, Code-first development and REST Services.
A general flowchart would be to:
- Determine the type of web service you're interested in developing (SOAP or REST).
- If SOAP, choose whether code-first or contract-first.
- Determine the deployment environment (servlet container or OSGi).
Also note the Eclipse-based Talend Studio provides additional graphical options, such as a RouteBuilder, if less programmatic methods of service development are desired.