尽管拥有 JAX-WS 的 Web 服务描述符并不是真正必要的,但 Weblogic 有时无法识别 Web 服务(无法找到原因)
以下是我为使其正常工作所做的工作。在 web.xml 中添加 WebService 实现类作为 Servlet
<?xml version='1.0' encoding='UTF-8'?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" id="WebApp_ID">
<display-name>MyWebService</display-name>
<servlet>
<servlet-name>serviceServlet</servlet-name>
<servlet-class>com.aneesh.WebServiceImpl</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>serviceServlet</servlet-name>
<url-pattern>/Service</url-pattern>
</servlet-mapping>
</web-app>
并添加 web 服务描述符 (webservices.xml)
<?xml version='1.0' encoding='UTF-8'?>
<webservices xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1">
<webservice-description>
<webservice-description-name>MyWebService</webservice-description-name>
<port-component>
<port-component-name>MyWebServiceSoapPort</port-component-name>
<wsdl-port xmlns:an="http://www.aneesh.com/service">an:MyWebServiceSoapPort</wsdl-port>
<service-endpoint-interface>com.aneesh.WebService</service-endpoint-interface>
<service-impl-bean>
<servlet-link>serviceServlet</servlet-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>