Java Reference
In-Depth Information
This catalog document has a few important elements, which we'll examine now.
The <system> element does the heavy lifting. It maps the document that is referenced by the
value of its systemId attribute to the value of its uri attribute. So, in the this example, any ap-
plication reference to “http://localhost:8080/soaCookbookWS/CatalogServiceSN?wsdl” will
be replaced with “src/xml/CatalogServiceSN.wsdl”.
NOTE
Relative URIs defined in your catalog file are always relative to the location of the catalog file itself.
The <public> element is constructed very much like <system> . It maps a given public iden-
tifier specified by its publicId attribute with the value of its uri attribute:
<public publicId="somePublicId" uri="someUri"/>
The <uri> element maps one URI to an alternate, and does so regardless of system or public
identifier resolution. It has this form:
<uri name="http://www.oasis-open.org/committees/docbook/"
uri="file:///projects/oasis/docbook/website/"/>
The root element, catalog , declares its namespace and features a prefer attribute. Valid val-
ues are either public or system . This attribute indicates which type of identifier should be
preferred if both are available. Let's look at a couple of possible scenarios. If your target docu-
ment contains both a public and a system identifier, and your catalog contains only a mapping
for public, and prefer=public, then the mapping for public will be used. However, if your tar-
get document contains only a system identifier, and your catalog contains only a mapping for
public, and prefer=public, there is no effect.
Using XML Catalogs in wsimport
The wsimport tool defines a -catalog <filename> option that allows you to specify the
path to an XML catalog file during import. This will cause the generated classes to use the
catalog to resolve external entity references.
The Ant task wrapper has a corresponding attribute, shown here:
<wsimport
wsdl="${wsdl.url}"
catalog="jax-ws-catalog.xml"
destdir="${gen.classes.dir}"
sourcedestdir="${src.gen.dir}"
keep="true"
extension="false"
Search WWH ::




Custom Search