About this task
To develop web services based on the JAX-WS programming
model, you can use a bottom-up development approach starting from
existing JavaBeans or enterprise beans
or you can use a top-down development approach starting with an existing
Web Services Description Language (WSDL) file. This task describes
the steps when using the bottom-up development approach.
When
developing JAX-WS web services starting from existing JavaBeans or enterprise beans, you can
expose the bean as a JAX-WS web service by using annotations. Adding
the @WebService or @WebServiceProvider annotation to the bean defines
the bean as a JAX-WS web service. JAX-WS web services can optionally
use a service endpoint interface. In addition to annotating the bean
and the optional service endpoint interface, you must assemble all
the artifacts that the web service requires, and deploy the resulting
application into the application server environment to complete the
process of enabling the bean as a web service. Although the use of
a WSDL file is considered a best practice, you are not required to
package a WSDL file with your JAX-WS web services.
- Considerations when using JavaBeans
-
- JavaBeans exposed as JAX-WS web services
are supported only over an HTTP transport.
- JavaBeans may
use Contexts and Dependency Injection (CDI). Note that constructor
injection is not supported.
- Considerations when using enterprise beans
-
- The enterprise bean must be a stateless or singleton session bean.
- Enterprise beans that are exposed as JAX-WS web services must
be packaged in EJB 3.0 or higher modules.
- JAX-WS applications containing enterprise beans must be deployed
with the endptEnabler command.
- JAX-WS web services using enterprise beans are supported over
an HTTP or Java Message Service (JMS) transport.
- Enterprise beans may use CDI. Note that constructor injection
is not supported.
-
When a web service is deployed in an enterprise
bean, the Web Services Description Language (WSDL) is required to
be packaged in the EJB JAR file.
aug2012
For transitioning users: Starting with WebSphere Application
Server Version 7.0 and later, 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 and later 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 application 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