我不知道如何在 Tomcat 上更改我的 JAX-WS WebService 的 URL。
localhost:8080/WSCalc/WSCalc?wsdl 运行正常,但我想将 URL 更改为 localhost:8080/ws/WSCalc/WSCalc?wsdl
通过下面的配置,我可以运行 localhost:8080/ws/WSCalc/(它是 index.jsp),但我不能运行 WebService localhost:8080/ws/WSCalc/WSCalc?wsdl(它返回 404)
目录 webapps/ 包括:
WSCalc.war
WSCalc/
-index.jsp
-META-INF/context.xml
-WEB-INF/web.xml
-WEB-INF/sun-jaxws.xml
-WEB-INF/classes/*
-WEB-INF/lib/*
网页.xml:
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>WSCalc</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WSCalc</servlet-name>
<url-pattern>/WSCalc</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
太阳jaxws.xml:
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="cz.vrana.WSCalc" name="WSCalc" url-pattern="/WSCalc"/>
</endpoints>
服务器.xml:
<Host name="localhost" appBase="webapps" unpackWars="true" autodeploy=""true">
<Context path="/ws" docBase="." />
</Host>