【问题标题】:Apache CXF - WS addressing how to set From, ReplyTo, HeadersApache CXF - WS 解决如何设置 From、ReplyTo、Headers
【发布时间】:2015-02-09 17:10:54
【问题描述】:

我有一个问题:我们正在尝试使用 Apache CXF 实现 WS-Addressing。我可以设置一些标头,例如 To 或 Action,但我找不到设置其他标头的方法,例如 From、ReplyTo 或 FaultTo。

有人知道怎么做吗?

【问题讨论】:

    标签: cxf ws-addressing


    【解决方案1】:

    看看http://cxf.apache.org/docs/ws-addressing.html。它在页面的末尾:

    AddressingProperties maps = new AddressingPropertiesImpl();
    EndpointReferenceType ref = new EndpointReferenceType();
    AttributedURIType add = new AttributedURIType();
    add.setValue("http://localhost:9090/decoupled_endpoint");
    ref.setAddress(add);
    maps.setReplyTo(ref);
    maps.setFaultTo(ref);
    
    ((BindingProvider)port).getRequestContext()
        .put("javax.xml.ws.addressing.context", maps);
    

    亲切的问候,土工

    【讨论】:

    • 作为注释,ep.getFeatures().add(new WSAddressingFeature());应该在创建之前添加到客户端代理工厂。没有它上面的代码不会添加地址信息
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-15
    • 2016-04-02
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2019-06-04
    • 2011-12-07
    相关资源
    最近更新 更多