【发布时间】:2013-04-02 12:56:33
【问题描述】:
我已经创建了一个 CXF JAXWS 服务,如下所示。
我提供了一个自定义 UserNameToken 验证器和一个回调处理程序。
但这不起作用。每次都会报错。
<http:inbound-endpoint address="http://localhost:8080/HelloService" exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.example.service.HelloServiceImpl" >
<cxf:ws-security>
<cxf:ws-config>
<cxf:property key="action" value="UsernameToken" />
</cxf:ws-config>
<cxf:ws-custom-validator >
<cxf:username-token-validator ref="customUsernameTokenValidator" />
</cxf:ws-custom-validator>
</cxf:ws-security>
<cxf:properties>
<spring:entry key="ws-security.ut.validator" value-ref="customUsernameTokenValidator" ></spring:entry>
<spring:entry key="ws-security.callback-handler" value-ref="myPasswordCallback" ></spring:entry>
</cxf:properties>
.....
.....
我的 WSDL 绑定策略如下
<sp:SupportingTokens>
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy />
</sp:UsernameToken>
</wsp:Policy>
</sp:SupportingTokens>
当我使用用户名令牌和密码从 SOAPUI 发出请求时,出现以下错误。
2013-04-10 11:08:13,811 WARN [qtp1221956599-40 - /HelloService] logging.LogUtils (LogUtils.java:384) - Interceptor for {http://example.org/HelloService}ProductSOAPService#{http://example.org/HelloService}addCompany has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.mule.module.cxf.MuleInvoker.invoke(MuleInvoker.java:106)
at org.mule.module.cxf.MuleJAXWSInvoker.invoke(MuleJAXWSInvoker.java:47)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
.....
.....
Caused by: java.lang.NullPointerException
at org.mule.module.cxf.MuleInvoker.invoke(MuleInvoker.java:60)
... 29 more
请帮助我了解我在这里遗漏了什么。
注意:我已经尝试了使用 cxf:ws-security 在 jaxws 上实现安全性的 Mule 方式,并且我的服务正在运行并给出正确的响应。
【问题讨论】:
标签: java jax-ws cxf mule ws-security