当您不直接定义时,默认情况下,JAX-WS 运行时会将后缀Service 添加到实现服务的类中,尽管这不是适用于所有运行时的规则。如果您想获取已部署的 WSDL,请尝试
http://localhost:9080/service/ServiceImplService?wsdl
或者
http://localhost:9080/service/ServiceImplService/ServiceImplService.wsdl
如果要更改模式 URL
@WebService(serviceName = "EchoService")
public class ServiceImpl implements Service {
@WebMethod
public String test(String who) {
return ("Hello " + who + "!");
}
}
试试
http://localhost:9080/service/EchoService?wsdl
在IBM Redbook - Application Server V7.0. Web Services Guide中查看更多信息
更新
如果要在WAS中部署EAR,基本结构是:
TestEAR.ear
| TestWeb.war
|
\---META-INF
MANIFEST.MF
WAR 文件进入这个 EAR 的结构是:
TestWeb.war
+---META-INF
| MANIFEST.MF
|
\---WEB-INF
| ibm-web-bnd.xml
| ibm-web-ext.xml
| web.xml
|
+---classes
| \---org
| \---paulvargas
| \---test
| | Service.class
| | ServiceImpl.class
| |
| \---jaxws
| Test.class
| TestResponse.class
|
\---lib
文件ibm-web-<i>xxx</i>.xml 是此示例的可选文件。 MANIFEST.MF 只有:
Manifest-Version: 1.0
Class-Path:
Test.class 和 TestResponse.class 文件(用于 WSDL 文档文件中的操作 test)由 wsgen 工具生成,其命令类似于:
wsgen -cp . org.paulvargas.test.ServiceImpl
web.xml 包含:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" 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_2_5.xsd">
<display-name>TestWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
wsdlLocation 是:
http://localhost:9080/TestWeb/ServiceImplService/ServiceImplService.wsdl
查看更多: