1

我尝试使用本教程 第 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>
4

1 回答 1

4

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

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

作为Authorization type选择Preemptive。(据我所知,仅在soapUI 4.5.1中)

于 2013-04-05T10:28:01.920 回答