enunciate

articulate your web api.

Java Client Module

The Java client module generates the client-side libraries that will access the Web service API. For SOAP endpoints, a client-side service interface will be generated that uses JAX-WS. For REST endpoints, the JAXB data model classes will be generated to access the XML endpoints. If there are any JSON endpoints, a set of data model classes will be generated that can be used in conjunction with the Jackson library to access them.

The order of the Java client module is 50, so as to allow the Java module to apply metadata to the endpoints before processing the client.

Steps

generate

The "generate" step is by far the most intensive and complex step in the execution of the Java client module. The "generate" step generates all source code for accessing the web service API.

compile

During the "compile" step, the Java client module compiles the code that was generated.

build

The "build" step assembles the classes that were assembled into a jar. If there are any JSON endpoints, the JSON client library will be assembled into a separate jar. It also creates a source jar for each library.

Configuration

The Java client module is configured by the "java-client" element under the "modules" element of the enunciate configuration file. It supports the following attributes:

  • The "label" attribute is used to determine the name of the client-side artifact files. The default is the Enunciate project label.
  • The "jarName" attribute specifies the name of the jar file(s) that are to be created. If no jar name is specified, the name will be calculated from the enunciate label, or a default will be supplied.
  • The "jsonJarName" attribute specifies the name of the jar file(s) that are to be created for the JSON client. If no jar name is specified, the name will be calculated from the enunciate label, or a default will be supplied.
  • The "disableCompile" attribute prevents Enunciate from compiling its generated client source files.

The "package-conversions" element

The "package-conversions" subelement of the "java-client" element is used to map packages from the original API packages to different package names. This element supports an arbitrary number of "convert" child elements that are used to specify the conversions. These "convert" elements support the following attributes:

  • The "from" attribute specifies the package that is to be converted. This package will match all classes in the package as well as any subpackages of the package. This means that if "org.enunciate" were specified, it would match "org.enunciate", "org.enunciate.api", and "org.enunciate.api.impl".
  • The "to" attribute specifies what the package is to be converted to. Only the part of the package that matches the "from" attribute will be converted.

The "json-package-conversions" element

The "json-package-conversions" element has the same purpose and syntax as the "package-conversions" element above, but is instead applied to the JSON java client. By default, ths JSON conversions will be the same as the "package-conversions" with the "json" subpackage appended.

The "server-side-type" element

An arbitrary number of "server-side-type" elements are allowed as child elements of the "java-client" element. The "server-side-type" element can be used to specify a server-side type that is to be ported directly over to the client-side library (as opposed to generating the client-side type from the server-side type). This can be useful to provide more useful client-side capabilities, but requires that there be no package conversions for types and web faults.

The "server-side-type" element supports one attribute, "pattern" that defines an ant-style pattern of the type(s) that are to be included (using a '.' for separating the package name).

Artifacts

The Java client module exports the following artifacts:

  • The libraries and sources are exported under the id "java.client.library". (Note that this is a bundle, so if exporting to a directory multiple files will be exported. If exporting to a file, the bundle will be zipped first.)
  • The libraries and sources for the json client library are exported under the id "java.json.client.library". (Note that this is a bundle, so if exporting to a directory multiple files will be exported. If exporting to a file, the bundle will be zipped first.)
Flattr this