我有一个企业应用程序,它由在WebSphere Application Server 7上运行的Web服务客户端组成。
当我尝试使用该服务时,我收到一个包含我请求的数据的响应(而不是错误),然后WebSphere引发了以下异常:
javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security
WebService使用用户名令牌进行身份验证,并且不使用邮件级别保护。
我创建了自定义策略集(WS-Addressing& WS-Security),删除了消息级保护,添加了用户名和密码的自定义绑定。
我使用SoapUI对此进行了测试,并且在使用WebSphere时,我从Web Service获得了相同的响应(而不是错误)。
我想念什么?
答案 0 :(得分:0)
最可能的原因是附加的策略集未正确加载。
附件是一个示例ws-security策略和绑定:
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512" xmlns:spe="http://www.ibm.com/xmlns/prod/websphere/200605/ws-securitypolicy-ext" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmi="http://schema.omg.org/spec/XMI/1.0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<sp:SupportingTokens>
<wsp:Policy wsu:Id="request:uname_token">
<sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SupportingTokens>
<sp:AsymmetricBinding>
<wsp:Policy>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:AsymmetricBinding>
</wsp:Policy>
<?xml version="1.0" encoding="UTF-8"?>
<securityBindings xmlns="http://www.ibm.com/xmlns/prod/websphere/200608/ws-securitybinding">
<securityBinding name="application">
<securityOutboundBindingConfig>
<tokenGenerator name="gen_unametoken" classname="com.ibm.ws.wssecurity.wssapi.token.impl.CommonTokenGenerator">
<valueType localName="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken" uri="" />
<callbackHandler classname="com.ibm.websphere.wssecurity.callbackhandler.UNTGenerateCallbackHandler">
<basicAuth userid="user1" password="security"/>
</callbackHandler>
<jAASConfig configName="system.wss.generate.unt"/>
<securityTokenReference reference="request:uname_token"/>
</tokenGenerator>
<timestampExpires expires="PT5M"/>
</securityOutboundBindingConfig>
<securityInboundBindingConfig>
<!-- No security defined on client inbound for this configuration -->
</securityInboundBindingConfig>
</securityBinding>
</securityBindings>
答案 1 :(得分:0)
我找到了解决方案。问题出在消息级保护上。如果我打开它,问题就会消失。我只需要确保没有指定要加密的部分,因此消息本身不会加密。