You can package a Java Application
Programming Interface (API) for XML Web Services (JAX-WS) application
as a Web service. A JAX-WS Web service is contained within a Web archive
(WAR) file or a WAR module within an enterprise archive (EAR) file.
A JAX-WS enabled WAR file contains:
- A WEB-INF/web.xml file
- Annotated classes that implement the Web services contained in
the application module
- [Optional] Web Services Description Language (WSDL) documents
that describe the Web services contained in the application module
A WEB-INF/web.xml file is similar to this example:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
</web-app>
The web.xml might contain servlet or servlet-mapping
elements. When customizations to the web.xml file
are not needed, the WebSphere® Application Server runtime
defines them dynamically as the module is loaded. For more information
on configuring the web.xml file, read about customizing
Web URL patterns in the web.xml file for JAX-WS
applications.
Annotated classes must contain, at a minimum, a Web service implementation
class that includes the @WebService annotation. The definition
and specification of the Web services-related annotations are provided
by the JAX-WS and JSR-181 specifications. The Web service implementation
classes can exist within the WEB-INF/classes or directory
within a Java archive (JAR) file that is
contained in the WEB-INF/lib directory of the WAR file.
You can optionally include WSDL documents in the JAX-WS application
packaging. If the WSDL document for a particular Web service is omitted,
then the WebSphere Application Server runtime
constructs the WSDL definition dynamically from the annotations contained
in the Web service implementation classes.
For transitioning users: Starting with WebSphere Application
Server Version 7.0, Java EE 5 application modules (Web application
modules version 2.5 or above, or EJB modules version 3.0 or above)
are scanned for annotations to identify JAX-WS services and clients.
However, pre-Java EE 5 application modules (Web application modules
version 2.4 or before, or EJB modules version 2.1 or before) are not
scanned for JAX-WS annotations, by default, for performance considerations.
In the Version 6.1 Feature Pack for Web Services, the default behavior
is to scan pre-Java EE 5 Web application modules to identify JAX-WS
services and to scan pre-Java EE 5 Web application modules and EJB
modules for service clients during application installation. Because
the default behavior for WebSphere Application Server
Version 7.0 is to not scan pre-Java EE 5 modules for annotations during
application installation or server startup, to preserve backward compatability
with the feature pack from previous releases, you must configure either
the UseWSFEP61ScanPolicy property in the META-INF/MANIFEST.MF of a
Web archive (WAR) file or EJB module or define the Java virtual
machine custom property, com.ibm.websphere.webservices.UseWSFEP61ScanPolicy,
on servers to request scanning during application installation and
server startup. To learn more about annotations scanning, see the
JAX-WS annotations information.trns
Avoid trouble: Beginning with Sun and HP JDK Version
1.6 containing JAX-WS tooling Version 2.1.6, the behavior of the JAX-WS
runtime environments and tooling has changed in how it determines
which methods are exposed as Web services operations in an effort
to better adhere to the JAX-WS specifications. Applications that might
be affected by this change include Web services applications that
do not specify a WSDL file or an explicit service endpoint interface
(SEI). To learn more, see the exposing methods in SEI-based JAX-WS
Web services information. gotcha