小编Soc*_*lla的帖子

Axis2客户端引发AxisFault:必须了解标头安全性检查失败

我正在使用Axis2-1.6.1,并且能够成功发送SOAP请求。这是请求的示例:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="true">
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>***username***</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:Nonce Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">***nonce***</wsse:Nonce>
        <wsu:Created Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">***datetime***</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://mysite/contract/users/v3/IUsers/EchoAuthenticated</wsa:Action>
  </soapenv:Header>
  <soapenv:Body>
    <ns6:EchoAuthenticated xmlns:ns6="http://mysite/contract/users/v3">
      <ns6:value>success</ns6:value>
    </ns6:EchoAuthenticated>
  </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

收到响应后,将引发此异常:

org.apache.axis2.AxisFault:必须了解标头http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd的检查失败:安全

经过一些研究后,我的印象是Axis2不喜欢响应。感到困惑的是,我复制了上面的请求并将其粘贴到SoapUI中并解雇了它。它有效,我收到以下回复。我还使用Fiddler确认,这与在Eclipse中发送此请求时得到的响应相同,只是Axis2不喜欢客户端,也许是mustUnderstand?

这是回应:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://mysite/contract/users/v3/IUsers/EchoAuthenticatedResponse</a:Action>
    <a:RelatesTo>urn:uuid:***guid***</a:RelatesTo>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="_0">
        <u:Created>***datetime***</u:Created>
        <u:Expires>***datetime***</u:Expires>
      </u:Timestamp>
    </o:Security>
  </s:Header>
  <s:Body>
    <EchoAuthenticatedResponse xmlns="http://mysite/contract/users/v3">
      <EchoAuthenticatedResult>This is the Users service answering back. The value you sent was: success</EchoAuthenticatedResult>
    </EchoAuthenticatedResponse>
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

由于与产品捆绑在一起,我只能使用较新版本的Axis2,但我的能力有限,但是我需要找出如何解决此错误的方法。

java client axis2 web-services

4
推荐指数
1
解决办法
1867
查看次数

Write-Information 未显示在由 Start-Transcript 转录的文件中

我正在使用 PowerShell 5.1,我试图确定为什么Write-Information消息不会显示在由创建的脚本日志中,Start-Transcript除非我设置$InformationPreferenceSilentlyContinue. 我想在控制台中显示消息并将它们写入日志文件。

我在这里看了:https : //docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-5.1#informationpreference

然后我决定创建这个脚本来测试写入的内容和时间。请参阅下方的首选项部分Testing explicit behavior with transcripts -------------

Clear-Host

$ErrorActionPreference = "Stop"

try {
    Write-Host "Starting transcript"
    Start-Transcript -Force -Path "$PSScriptRoot\default.txt"

    <#
        In PowerShell 5.1 the default behavior is as follows:
            $DebugPreference       = SilentlyContinue
            $InformationPreference = SilentlyContinue
            $ProgressPreference    = Continue
            $VerbosePreference     = SilentlyContinue

        See the following for more information:
        https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-5.1
    #>

    # I am not testing Write-Output as I am not worried about …
Run Code Online (Sandbox Code Playgroud)

powershell cmdlets logging powershell-v5.1

4
推荐指数
1
解决办法
1316
查看次数