【发布时间】:2015-12-02 01:12:25
【问题描述】:
我正在使用 Camel cxf 实现一个 Web 服务,以部署在 Karaf 中。 我正在使用 karaf 附带的 pax web。我在 pom 中使用 cxf codegen 插件对 java 做 wsdl。
我在 RouteBuilder Java DSL 中定义 cxf uri 和路由。 blueprint.xml 只有一些 bean 和 RouteBuilder 的引用。
final String cxfUri =
String.format("cxf:%s?serviceClass=%s&wsdlURL=wsdl/Event.wsdl",
"/Event.jws", com.example.EventPortType.class.getCanonicalName());
我已经使用 pax-web(jetty.xml) 设置了 ssl。如果我发送带有用户名和密码的 WSSE 安全标头,它会生成 MustUnderstand soap 错误。
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" S:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-LdZa8aaGdy7mWQWXLp_zpbfg">
<wsse:Username>xxx</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxx</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
无法更改输入请求。 我得到了这个例外。
<soap:Fault>
<faultcode>soap:MustUnderstand</faultcode>
<faultstring>MustUnderstand headers: [{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood.</faultstring>
</soap:Fault>
如何保护 cxf 端点以验证请求?
谢谢。
【问题讨论】:
-
遵循骆驼分布 2.15.1 中的示例 - camel-example-reportincident-wssecurity 并且它有效。它使用 WSSJInterceptor 和 CallbackHandler。
标签: web-services apache-camel cxf apache-karaf pax-web