【发布时间】:2013-01-12 01:41:14
【问题描述】:
我使用 JAX-WS RT 开发了一个简单的 Web 服务,并将其部署在 Tomcat 6 服务器上。我需要使用 SOAP 标头中的 ws-security 来验证对我的 Web 服务的调用。
我的方法是使用链处理程序来提取soap 标头中的用户名和密码并在我的代码中进行身份验证。这是正确的方法吗?如果不是,正确的方法是什么?
使用soapUI,我通过以下标头发送了
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
使用此标头我收到以下错误
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultstring>MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood</faultstring>
<faultcode>SOAP-ENV:MustUnderstand</faultcode>
</SOAP-ENV:Fault>
使用 JAX-WS rt 如何设置我的 Web 服务以接受这种类型的标头并进行身份验证。
【问题讨论】:
标签: jax-ws tomcat6 ws-security soapheader