缺少wsse:请求中的安全标头

时间:2013-04-04 11:37:22

标签: eclipse axis2 soapui rampart

我尝试使用此tutorial 第19-22页

为我的轴2项目添加垒垒安全性

所以一切似乎都很好但是当我切换到soapUI透视图来尝试测试服务时 我提出的要求是:

soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis="http://axis2wstest">
 <soapenv:Header/>
   <soapenv:Body>
      <axis:testws>
         <!--Optional:-->
         <axis:x>5</axis:x>
      </axis:testws>
   </soapenv:Body>
</soapenv:Envelope>

它给了我一个回复:

faultstring>Missing wsse:Security header in request</fau

所以我添加了安全标头,我的请求变得和教程中写的一样

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis="http://axis2wstest">
 <soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-
200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-
open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="123">
<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">pass</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
   <soapenv:Body>
      <axis:testws>
         <!--Optional:-->
         <axis:x>5</axis:x>
      </axis:testws>
   </soapenv:Body>
</soapenv:Envelope>

但响应相同

soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <faultcode>wsse:InvalidSecurity</faultcode>
         <faultstring>Missing wsse:Security header in request</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

1 个答案:

答案 0 :(得分:4)

请勿将安全标头直接添加到您的请求中!

点击左下方的自动。然后你可以在那里输入你的用户名/密码。 有关详细信息,请参阅:http://www.soapui.org/SOAP-and-WSDL/authenticating-soap-requests.html

作为授权类型选择 Preemptive 。 (据我所知,仅在soapUI 4.5.1中)