+

Search Tips   |   Advanced Search

WSDL

WSDL is an XML-based description language for describing web services.

A WSDL document defines services as collections of network endpoints, or ports. In WSDL, the abstract definitions of endpoints and messages are separated from their concrete network deployment or data format bindings. Messages are abstract descriptions of exchanged data, port types are abstract collections of operations. The concrete protocol and data format specifications for a particular port type constitutes a reusable binding. A port is defined by associating a network address with a reusable binding, and a collection of ports defines a service.

A WSDL file contains the following parts:

A WSDL file describes a web service with the following elements:


portType

Description of the operations and associated messages.


message

The description of input and output parameters and return values.


types

The schema for describing XML types used in the messages.


binding

The bindings describe the protocol used to access a portType, as well as the data formats for the messages defined by a particular portType element.


Service

The services and ports define the location of the Web service. The service contains the web service name and a list of ports.


Ports

The ports contain the location of the web service and the binding used for service access.

When creating JAX-WS or JAX-RPC web services, we can use a bottom-up development approach when you start from JavaBeans or an enterprise bean, or we can use a top-down development approach when you start with an existing WSDL file.

. If we start with an implementation bean class, use the wsgen tool to generate the web services server artifacts, including a WSDL if requested. If we start with a WSDL, use the wsimport tool to generate the web services artifacts for either the server or client side.

When creating JAX-RPC web services, first have an implementation bean that includes a service endpoint interface. Then, you use the Java2WSDL command-line tool to create a WSDL file that defines the web services. If we are starting with the WSDL to generate the implementation bean class, run the WSDL2Java tool against the WSDL file to create Java APIs and deployment descriptor templates.


Multipart WSDL and WSDL publication

The product supports deployment of web services using a multipart WSDL file. In multipart WSDL files, an implementation WSDL file contains the wsdl:service. This implementation WSDL file imports an interface WSDL file, which contains the other WSDL constructs. This supports multiple web services using the same WSDL interface definition.

The <wsdl:import> element indicates a reference to another WSDL file. If the <wsdl:import> element location attribute does not contain a URL, that is, it contains only a file name, and does not begin with http://, https:// or file://, the imported file must be located in the same directory and must not contain a relative path component. For example, if META-INF/wsdl/A_Impl.wsdl is in the module and contains the <wsdl:import="A.wsdl" namespace="..."/> import statement, the A.wsdl file must also be located in the module META-INF/wsdl directory.

IBM recommends that you place all WSDL files in either the META-INF/wsdl directory, if you are using EJB, or the WEB-INF/wsdl directory, if you are using JavaBeans components, even if relative imports are located within the WSDL files. Otherwise, implications exist with the WSDL publication when you use a path like...

Using a path like this example fails because the presence of the relative path, regardless of whether the file is located at that path or not. If the location is a web address, it must be readable at both deployment and server startup.

We can publish the files located in the META-INF/wsdl or the WEB-INF/wsdl directory through either a URL address or file, including WSDL or XML Schema Definition (XSD) files. For example, if the file referenced in the <wsdl-file> element of the webservices.xml deployment descriptor is located in the META-INF/wsdl or the WEB-INF/wsdl directory, it is publishable. If the files imported by the <wsdl-file> are located in the wsdl/ directory or its subdirectory, they are publishable.

If the WSDL file referenced by the <wsdl-file> element is located in a directory other than wsdl, or its subdirectories, the file and its imported files, either WSDL or XSD files, which are in the same directory, are copied to the wsdl directory without modification when the application is installed. These types of files can also be published.

If the <wsdl-file> imports a file located in a different directory (a directory that is not -INF/wsdl or a subdirectory), the file is not copied to the wsdl directory and not available for publishing.

For JAX-WS web services, we can use an annotation to specify the location of the WSDL. Use the @WebService annotation with the WSDLLocation attribute. The WSDLLocation attribute is optional. If this attribute is not specified, then WSDL is generated and published from the information found in the web service classes. We can optionally specify the location of the WSDL file in the webservices.xml deployment descriptor. However, any information defined in the webservices.xml deployment descriptor overrides any corresponding information specified by annotations.


Related concepts

Web Services for Java EE specification
  • Generating Java artifacts for JAX-WS applications
  • Develop a WSDL file for JAX-RPC applications
  • Making deployed web services applications available to clients
  • wsimport command for JAX-WS applications
  • wsgen command for JAX-WS applications
  • Java2WSDL command for JAX-RPC applications
  • WSDL2Java command for JAX-RPC applications
  • Web services specifications and APIs
    WSDL 1.1