这些政策选择无法令人满意

时间:2018-02-03 00:45:23

标签: soap soapui policy

所以我试图用SoapUI测试SOAP端点。

这就是我的SOAP请求的样子

SELECT TOP 10 WITH TIES *
FROM (SELECT ParentCommentText,ParentCommentID,ParentCommentTimeStamp as comment_timestamp
      FROM ParentComments 
      UNION ALL
      SELECT ChildCommentText,ChildCommentID,ChildCommentTimeStamp
      FROM ChildComments
     ) T
ORDER BY comment_timestamp DESC

我一直得到这个回复

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soapenv:Header>
      <o:Security soapenv:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <o:UsernameToken u:Id="uuid-6a13a244-dac6-42c1-84c5-cbb345b0c4c4-1">
            <o:Username>username</o:Username>
            <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password>
         </o:UsernameToken>
      </o:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ns:RequestSecurityToken Context="?">
         <!--You may enter ANY elements at this point-->
      </ns:RequestSecurityToken>
   </soapenv:Body>
</soapenv:Envelope>

如果我将<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:MustUnderstand</faultcode> <faultstring>MustUnderstand headers: [{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Security] are not understood.</faultstring> </soap:Fault> </soap:Body> </soap:Envelope> 的值更改为0,则会出现此错误

mustUnderstand

我的安全政策如下所示:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>These policy alternatives can not be satisfied: 
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/}SupportingTokens
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/}UsernameToken</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

不确定我现在缺少什么。有谁知道我错过了什么?

1 个答案:

答案 0 :(得分:0)

我想出了答案。我们没有使用org.apache.cxf:cxf-rt-ws-securityorg.apache.cxf:cxf-rt-ws-policy个罐子。我会写一篇帖子来详细解释这个。