此内容没有您所选择的语言版本。

Chapter 4.  WS Addressing


CXF provides support for the 2004-08 and 1.0 versions of WS-Addressing. Users can enable WS-Addressing either using the standard JAX-WS approach or using the Apache CXF WS Addressing Feature on their service.

4.1. Using JAX-WS for enabling WS-Addressing

As per JAX-WS 2.1 specification, users can enable WS-Addressing on a web service endpoint by simply adding the @javax.xml.soap.Addressing annotation.
 
package org.jboss.test.ws.jaxws.samples.wsa; 

import javax.jws.WebService;
import javax.xml.ws.soap.Addressing;
@WebService
@Addressing(enabled=true, required=true)
public class ServiceImpl implements ServiceIface
{
   public String sayHello()
   {
      return "Hello World!";
   }
}
Copy to Clipboard Toggle word wrap
On the client side, WS-Addressing can be explicitly enabled by providing org.apache.cxf.ws.addressing.WSAddressingFeature when getting the proxy instance from the service:
  ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class, new AddressingFeature());
proxy.sayHello());
Copy to Clipboard Toggle word wrap

4.1.1. Using CXF proprietary WSAddressingFeature

To enable WS-Addressing, enable the WSAddressingFeature on your service. If you wish to use XML to configure this, use the following syntax:
    
<jaxws:endpoint id="{your.service.namespace}YourPortName">
   <jaxws:features>
     <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
   </jaxws:features>
</jaxws:endpoint>
Copy to Clipboard Toggle word wrap
You can also use the same exact syntax with a <jaxws:client>:
 
<jaxws:client id="{your.service.namespace}YourPortName">
   <jaxws:features>
     <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
   </jaxws:features>
</jaxws:client>
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat