如何在Postman中配置传出WS-Security?

jhkqcmku  于 2022-11-07  发布在  Postman
关注(0)|答案(1)|浏览(122)

该请求在SoapUI中工作,但由于我们使用Postman-Newman实现此API的自动化,因此如何在Postman中工作。
我看到了一些解决方案,其中要求在请求正文中添加安全标记,但要提供的用户名是什么,因为我们在SoapUI中没有提供任何用户名。
如何在SoapUI中配置
1.选择密钥库,然后选择证书并添加密码
1.设置“Outgoing WS-Security Configurations”(输出WS-Security配置),并附上屏幕截图,以显示我们必须在其中发送的内容。密钥库、密码、密钥标识符类型和部件

Postman 配置:
1.使用设置在postman中添加证书,并添加密码。
1.已创建请求并添加了请求正文
在请求正文中,我在下面尝试过,但我不确定用户名或随机数是什么,因为我们在SoapUI中没有给予此信息。这将返回错误The SOAP request has not been signed, or is signed incorrectly

<wsse:Security xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
<wsu:Timestamp wsu:Id='TS-11b7d3261c994de099eb8c431b33947b'>
<wsu:Created>2019-09-06T12:09:15.604Z</wsu:Created>
<wsu:Expires>2019-09-06T12:09:25.619Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id='UsernameToken-238be95be3bf445fb8534666a7a8693c'>
<wsse:Username>***login***</wsse:Username>
<wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-usernametoken-profile-1.0#PasswordDigest'>***Base64 (SHA-1 (nonce + created + password) )***</wsse:Password>
<wsse:Nonce EncodingType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soapmessage-security-1.0#Base64Binary'>***Base64 nonce***</wsse:Nonce>
<wsu:Created>2019-09-06T12:09:15.604Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>

下面也试过了,这里我得到了肥皂故障

<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>XXXXX</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>

还尝试了以下解决方案,但不确定在此处提供什么用户名,因为我们只在SoapUI中提供密码,而不提供用户名

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <wsse:Username>Whattogivehere</wsse:Username>
                <wsse:Password>******</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
3j86kqsm

3j86kqsm1#

在SOAP头中包含WS-Security头部分,如下所示。另外,请确保以纯文本形式输入正确的用户名和密码。

<soapenv:Header>
       ------

>     <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
>          <wsse:UsernameToken wsu:Id="UsernameToken-16" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
>             <wsse:Username>XXXXX</wsse:Username>
>             <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</wsse:Password>
>          </wsse:UsernameToken>
>       </wsse:Security>

      ----
 </soapenv:Header>

相关问题