JAX-WS application packaging
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 application archive (WAR) file or a WAR module within an enterprise archive (EAR) file.
- 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
<?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, see 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.
從 WebSphere Application Server 7.0 版和更新的版本開始,系統會掃描 Java EE 5 應用程式模組(Web 應用程式模組 2.5 版或更新版本,或是 EJB 模組 3.0 版或更新版本)中是否有註釋可識別 JAX-WS 服務和用戶端。 不過,為了效能考量,依預設,系統不會掃描 Java EE 5 之前的應用程式模組(Web 應用程式模組 2.4 版或更早版本,或 EJB 模組 2.1 版或更早版本)中是否有 JAX-WS 註釋。在 6.1 版 Feature Pack for Web Services 中,預設行為是在應用程式安裝期間,掃描 Java EE 5 之前的 Web 應用程式模組來識別 JAX-WS 服務,以及掃描 Java EE 5 之前的 Web 應用程式模組和 EJB 模組,來尋找服務用戶端。由於 WebSphere Application Server 7.0 版及更新版本的預設行為是不在安裝應用程式或啟動伺服器期間掃描 Java EE 5 之前的模組是否含有註釋,因此為了保留與舊版特性套件的舊版相容性,您必須在伺服器上配置 Web 應用程式保存檔 (WAR) 的 META-INF/MANIFEST.MF 中的 UseWSFEP61ScanPolicy 內容或 EJB 模組,或定義 Java 虛擬機器自訂內容 com.ibm.websphere.webservices.UseWSFEP61ScanPolicy,來要求在安裝應用程式及啟動伺服器期間進行掃描。如果要進一步瞭解註釋掃描,請參閱 JAX-WS 註釋資訊。


If the SEI and the implementation classes cannot be packaged with the application/module, we recommend packaging the jar files that contain these classes into an isolated shared library and associating this shared library with the application/module.
gotcha