Show Table of Contents
3.2.4. Web Services 的修改
3.2.4.1. Web Services 的修改
JBoss EAP 6 包含了对部署 JAX-WS Web 服务器端点的支持。这种支持是 JBossWS 提供的。关于 Web Service 的更多信息,请参考 https://access.redhat.com/site/documentation/JBoss_Enterprise_Application_Platform/ 上的《部署指南》里的《JAX-WS Web Services》章节。
JBossWS 4 包含了下列可能影响移植的修改。
- JBossWS API 的修改
- JBossWS 4 里引用了 SPI 和公用组件。下表列出了可能影响应用程序移植的 API 和软件包修改。
表 3.8. JBossWS API 的修改
旧的 JAR 旧的软件包 新的 JAR 新的软件包 JBossWS SPI org.jboss.wsf.spi.annotation.* JBossWS API org.jboss.ws.api.annotation.* JBossWS SPI org.jboss.wsf.spi.binding.* JBossWS API org.jboss.ws.api.binding.* JBossWS SPI org.jboss.wsf.spi.management.recording.* JBossWS API org.jboss.ws.api.monitoring.* JBossWS SPI org.jboss.wsf.spi.tools.* JBossWS API org.jboss.ws.api.tools.* JBossWS SPI org.jboss.wsf.spi.tools.ant.* JBossWS API org.jboss.ws.tools.ant.* JBossWS SPI org.jboss.wsf.spi.tools.cmd.* JBossWS API org.jboss.ws.tools.cmd.* JBossWS SPI org.jboss.wsf.spi.util.ServiceLoader JBossWS API org.jboss.ws.api.util.ServiceLoader JBossWS Common org.jboss.wsf.common.* JBossWS API org.jboss.ws.common.* JBossWS Common org.jboss.wsf.common.handler.* JBossWS API org.jboss.ws.api.handler.* JBossWS Common org.jboss.wsf.common.addressing.* JBossWS API org.jboss.ws.api.addressing.* JBossWS Common org.jboss.wsf.common.DOMUtils JBossWS API org.jboss.ws.api.util.DOMUtils JBossWS Native org.jboss.ws.annotation.EndpointConfig JBossWS API org.jboss.ws.api.annotation.EndpointConfig JBossWS 框架 org.jboss.wsf.framework.invocation.RecordingServerHandler JBossWS Common org.jboss.ws.common.invocation.RecordingServerHandler - @WebContext Annotation
- 在 JBossWS 3.4.x 里,这个注解在 JBossWS SPI JAR 被打包为
org.jboss.wsf.spi.annotation.WebContext。在 JBossWS 4.0 里,这个注解被移至 JBossWS API JAR 里的org.jboss.ws.api.annotation.WebContext。如果你的应用程序包含了过时的依赖关系,你必须替换源代码里的导入和依赖关系并根据新的 JBossWS API JAR 重新编译。本版里对于不向后兼容的属性也有改动。String[] virtualHosts属性已经改为String virtualHost。在 JBoss EAP 6 里,对于每个部署您可以只指定一个虚拟主机。如果多个 web service 使用了@WebContext注解,对于部署归档里定义的所有端点,virtualHost 值都必须是相等的。 - 端点配置
- JBossWS 4.0 提供了 JBoss Web Service 栈和多数 Apache CXF 模块的集成。集成层允许使用标准 webservice API,包括 JAX-WS。它也允许在 JBoss EAP 6 容器上使用 Apache CXF 的高级功能而无需复杂的配置或设置。JBoss EAP 6 的域配置里的
webservice子系统包含了预定义的端点配置。您也可以定义自己的其他端点配置。@org.jboss.ws.api.annotation.EndpointConfig注解被用来引用给定的端点配置。关于配置 JBoss 服务器里 webservice 端点的更多信息,请参考 https://access.redhat.com/site/documentation/JBoss_Enterprise_Application_Platform/ 上的《JBoss EAP 6 开发指南》里的『JAX-WS Web Services』章节。 - jboss-webservices.xml 部署描述符
- JBossWS 4.0 引入了新的部署描述符来配置 web service。
jboss-webservices.xml文件为给定的部署提供了其他信息并部分地替换了过时的jboss.xml文件。对于 EJB webservice 部署,jboss-webservices.xml描述符文件期望的位置是META-INF/目录。对于 POJO 和 WAR 里捆绑的EJB webservice 端点,jboss-webservices.xml文件期望的位置是META-INF/目录。下面是jboss-webservices.xml描述符文件和描述元素的表的例子。<webservices> <context-root>foo<context-root> <config-name>Standard WSSecurity Endpoint</config-name> <config-file>META-INF/custom.xml</config-file> <property> <name>prop.name</name> <value>prop.value</value> </property> <port-component> <ejb-name>TestService</ejb-name> <port-component-name>TestServicePort</port-component-name> <port-component-uri>/*</port-component-uri> <auth-method>BASIC</auth-method> <transport-guarantee>NONE</transport-guarantee> <secure-wsdl-access>true</secure-wsdl-access> </port-component> <webservice-description> <webservice-description-name>TestService</webservice-description-name> <wsdl-publish-location>file:///bar/foo.wsdl</wsdl-publish-location> </webservice-description> </webservices>表 3.9. jboss-webservice.xml 文件元素描述
名称 描述 context-root用来自定义 webservices 部署的根上下文。config-nameconfig-file用来关联端点部署和给定的端点配置。端点配置是在引用的配置文件或域配置的webservices子系统里指定的。property用来设置简单属性的名称/值对以配置 webservice 的栈行为。port-component用来自定义 EJB 端点目标 URI 以配置和安全性相关的属性。webservice-description用来自定义或覆盖 webservice WSDL 的发布位置。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.