Apache CXF - WS解决了如何设置From,ReplyTo,Headers的问题

时间:2014-12-11 09:15:45

标签: cxf ws-addressing

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

有人知道怎么做吗?

1 个答案:

答案 0 :(得分:6)

看看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);
亲切的问候,土壤工人