Java 使用SOAPUI在WebSphereV7上调用JAX-WSWeb服务
我将JAX-WSWeb服务打包在EAR中,并部署到WebSphereV7。 耳朵包含:Java 使用SOAPUI在WebSphereV7上调用JAX-WSWeb服务,java,jax-ws,websphere-7,Java,Jax Ws,Websphere 7,我将JAX-WSWeb服务打包在EAR中,并部署到WebSphereV7。 耳朵包含: -APP-INF目录:类目录(.class文件位于正确的包层次结构中)加上带有所需JAR的lib目录 -META-INF目录 -带有空WEB-INF和META-INF目录以及HelloWorld index.html的战争 我有两门课: @WebService public interface Service {} 以及: (libdir中的jar是业务逻辑所必需的,我只是用一个简单的hello+who替换
-APP-INF目录:类目录(.class文件位于正确的包层次结构中)加上带有所需JAR的lib目录
-META-INF目录
-带有空WEB-INF和META-INF目录以及HelloWorld index.html的战争
我有两门课:
@WebService
public interface Service {}
以及:
(libdir中的jar是业务逻辑所必需的,我只是用一个简单的hello+who替换了这个逻辑)
我已经在WASV7中部署了EAR,现在我想使用SOAPUI测试它。我已为以下内容设置了上下文根:/服务
在部署期间 在哪里可以找到生成的WSDL及其地址/端点是什么
我对这一点一无所知,在WASV7上提供一个有用的JAX-WS完整教程链接也可以。我找不到任何,尽管我已经在谷歌上搜索了几个小时…当您不直接定义时,默认情况下,JAX-WS运行时会向实现该服务的类添加后缀
Service
,尽管这不是所有运行时的规则。如果您想要获得部署的WSDL,请尝试
http://localhost:9080/service/ServiceImplService?wsdl
或
如果要更改模式URL
@WebService(serviceName = "EchoService")
public class ServiceImpl implements Service {
@WebMethod
public String test(String who) {
return ("Hello " + who + "!");
}
}
试一试
更多信息请参见
更新
如果要在WAS中部署EAR,基本结构是:
TestEAR.ear
| TestWeb.war
|
\---META-INF
MANIFEST.MF
此EAR中WAR文件的结构为:
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
文件IBMWebxxx.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>
请参阅更多:
wsgen
工具生成工件。在类中只需要@WebService
注释。自动生成工件。我只有Eclipse和ant。我在Eclipse中添加了一个Websphere服务器,但它说:“不支持托管(联合)Websphere Application server网络部署环境”,因此我通过管理控制台部署由ant任务创建的EAR。
Manifest-Version: 1.0
Class-Path:
wsgen -cp . org.paulvargas.test.ServiceImpl
<?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>
http://localhost:9080/TestWeb/ServiceImplService/ServiceImplService.wsdl