Chapter 11. Understanding How Endpoints are Defined in WSDL
Endpoints represent an instantiated service. They are defined by combining a binding and the networking details used to expose the endpoint.
An endpoint can be thought of as a physical manifestation of a service. It combines a binding, which specifies the physical representation of the logical data used by a service, and a set of networking details that define the physical connection details used to make the service contactable by other endpoints.
Endpoints and services
In the same way a binding can only map a single interface, an endpoint can only map to a single service. However, a service can be manifested by any number of endpoints. For example, you could define a ticket selling service that was manifested by four different endpoints. However, you could not have a single endpoint that manifested both a ticket selling service and a widget selling service.
The WSDL elements
Endpoints are defined in a contract using a combination of the WSDL
serviceelement and the WSDL
serviceelement is a collection of related
portelements define the actual endpoints.
serviceelement has a single attribute,
name, that specifies a unique name. The
serviceelement is used as the parent element of a collection of related
portelements. WSDL makes no specification about how the
portelements are related. You can associate the
portelements in any manner you see fit.
portelement has a has a
bindingattribute, that specifies the binding used by the endpoint and is a reference to the
wsdl:bindingelement. It also includes the
nameattribute, which is a mandatory attribute that provides a unique name among all ports. The
portelement is the parent element of the elements that specify the actual transport details used by the endpoint. The elements used to specify the transport details are discussed in the following sections.
Adding endpoints to a contract
Apache CXF provides command line tools that can generated endpoints for predefined service interface and binding combinations.
The tools will add the proper elements to your contract for you. However, it is recommended that you have some knowledge of how the different transports used in defining an endpoint work.
You can also add an endpoint to a contract using any text editor. When you hand edit a contract, you are responsible for ensuring that the contract is valid.
Endpoint definitions are built using extensions defined for each of the transports Apache CXF supports. This includes the following transports:
- Java Messaging Service