4

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

有人知道怎么做吗?

4

1 回答 1

7

看看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);

亲切的问候,土工

于 2014-12-11T09:44:50.743 回答