我希望可以同时提出两个相关的问题。我正在使用骆驼路由将 SOAP 消息发送到使用可靠消息传递的 Web 服务。现在我遇到了两个问题,首先使用的 WS-Addressing 版本是错误的,我需要 2005/08 但它使用的是 2004/08。
用于设置我正在使用的端点(缩短一点)
CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setWsdlURL(getWsdlURL());
cxfEndpoint.setDataFormat(DataFormat.CXF_MESSAGE);
cxfEndpoint.setCamelContext(camelContext);
camelContext.addEndpoint(outEndpoint.getId(), cxfEndpoint);
我还在 camel-context.xml 文件中设置了一个 cxfbus 和一个单独的 http-conduit.xml
现在我对 WS-Addressing 的问题是,如何将其更改为使用 WS-Addressing 2005/08?在调用端点之前,我已经尝试在我的路由中添加以下内容,但它没有更改寻址命名空间。
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
AddressingPropertiesImpl addrProps =
new AddressingPropertiesImpl("http://www.w3.org/2005/08/addressing");
Map<String, Object> requestContext = new HashMap<String, Object>();
requestContext.put("javax.xml.ws.addressing.context", addrProps);
exchange.getIn().setHeader(Client.REQUEST_CONTEXT, requestContext);
}
})
关于 CreateSequence 中的 Offer,在端点添加到 CamelContext 之前添加了以下内容:
RMManager rmManager = cxfEndpoint.getBus().getExtension(RMManager.class);
rmManager.getSourcePolicy().setIncludeOffer(false);
虽然这很好用,但它有一个令人讨厌的副作用,即我的 http-conduit 不再使用。我用以下方法解决了这个问题:
cxfEndpoint.setBus(bus);
公共汽车在哪里@Autowired
但在我看来,这破坏了以类似方式创建的传入 CXF 端点的 WS-Reliable Messaging。它仍然发送正确的消息,但在发送 CreateSequenceResponse 之前,发送了一个空的 SOAP 消息,这导致客户端退出序列创建。
现在我的问题是,有没有更好的方法从 CreateSequence 中删除 Offer?