soap - SOAP WSS4JInInterceptor 安全处理失败(操作不匹配)
问题描述
我一直在苦苦挣扎,几天来试图获得一个简单的 SOAP 请求以通过 WS-Security,经过许多电子邮件后,我终于能够从服务提供商那里获得一些日志......
请注意,网络服务是 SOAP 1.2
2021-04-11 23:49:24,052:INFO :ajp-nio-127.0.0.1-8009-exec-5:ptor.Soap12FaultOutInterceptor:class org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor$Soap12FaultOutInterceptorInternalapplication/soap+xml
2021-04-11 23:49:47,867:WARN :ajp-nio-127.0.0.1-8009-exec-28:urity.wss4j.WSS4JInInterceptor:Security processing failed (actions mismatch)
2021-04-11 23:49:47,867:WARN :ajp-nio-127.0.0.1-8009-exec-28:xf.phase.PhaseInterceptorChain:Interceptor for {http://[redacted]/rti/cdd/wsdl}CDDService has thrown exception, unwinding now
可悲的是,这并没有多大帮助,因为在搜索此错误时它似乎很模棱两可,其中一个提到了 WSS4JInInterceptor 中的一个错误,其中正文打开标记和第一个节点之间的空格可能会导致这种情况,但是即使在删除那个空格,我仍然收到同样的错误。
这是我发送的 XML(使用Content-Type: application/soap+xml;charset=utf-8;action="mySoapAction"
标头),服务提供商已确认他们正在接收完整的 XML 正文:
<?xml version="1.0"?>
<soapenv:Envelope xmlns:sch="http://[redacted]/rti/cdd/schema" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1618447264">
<wsse:Username>[redacted]</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0#PasswordText">[redacted]</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<sch:cddRequest clientID="1213" clientCandidateId="3">
<candidateName>
<firstName>Learner</firstName>
<lastName>Learner</lastName>
</candidateName>
<webAccountInfo>
<email>learner@nowhere.com</email>
</webAccountInfo>
<lastUpdate>2021/04/15 00:47:44 BST</lastUpdate>
<primaryAddress>
<addressType>Home</addressType>
<address1>[redacted]</address1>
<address2>[redacted]</address2>
<city>Gold Coast</city>
<postalCode>4218</postalCode>
<country>AU</country>
<phone>
<phoneNumber>[redacted]</phoneNumber>
<phoneCountryCode>[redacted]</phoneCountryCode>
</phone>
</primaryAddress>
<candidatePrefs>
<candidatePref prefType="ConfirmationPreference">
<prefOption>email</prefOption>
</candidatePref>
<candidatePref prefType="ReminderPreference">
<prefOption>email</prefOption>
</candidatePref>
<candidatePref prefType="LocalePreference">
<prefOption>en_GB</prefOption>
</candidatePref>
</candidatePrefs>
</sch:cddRequest>
</soapenv:Body>
</soapenv:Envelope>
非常感谢任何帮助。
解决方案
您标记了 WSS4J 问题,但您是否有手写安全标头?因为你所有的命名空间都是错误的:
wsse = http://docs.oasis-open.org/wss/2004/01/oasis200401-wss-wssecurity-secext-1.0.xsd
wsu = http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
Type attribute = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0#PasswordText
注意破折号 ( -
)。
正确的命名空间是:
wsse = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
wsu = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
Type attribute = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
推荐阅读
- reactjs - 如何在 React-Native 中正确创建 WebSocket,它被多次创建
- csv - 结构化 Spark Streaming:writeStream 显示空数据帧
- reactjs - React Typescript Material-UI useStyles不可调用
- python - autocomplete-python 不适用于 atom python 3.9
- selenium - 标签元素中的复选框未发生 Selenium Click
- arrays - ReactJS 组件不使用 Firebase db 和 map 函数渲染
- html - CSS 选择器:父类匹配子类
- javascript - 我想使用 div 添加弹出消息
- typescript - 如何在 Map 中定义对类型 V 进行操作的扩展函数
在打字稿中? - java - Bean 后处理器不适用于 @MockBean bean