在SoapUi上使用UserName身份验证测试的WCF Web服务

时间:2012-11-13 11:04:07

标签: wcf authentication soapui username

我的WCF WebService具有UserName身份验证,无法使用Soapui进行测试。

这里有web.config:

<behaviors>
      <serviceBehaviors>
        <behavior name="FHPBusinessLogicService.ServiceBehavior">
          <serviceCredentials type="FHPBusinessLogicService.Security.PasswordServiceCredentials, FHPBusinessLogicService">
            <userNameAuthentication userNamePasswordValidationMode="Custom" />
          </serviceCredentials>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceAuthorization principalPermissionMode="Custom" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="ServiceConf" maxReceivedMessageSize="65536" >
          <readerQuotas maxStringContentLength="65536" maxArrayLength="65536" maxBytesPerRead="65536" />
          <security mode="TransportWithMessageCredential"  >
            <message clientCredentialType="UserName"  />

          </security>

        </binding>
      </basicHttpBinding>
    </bindings>

在Soapui我收到: 验证消息的安全性时发生错误

我正在我的本地计算机上测试它,本地iis 7服务器。

有什么建议吗?

2 个答案:

答案 0 :(得分:20)

在SoapUI的“请求属性”中的“Wss-Password Type”部分,只需选择选项“ PasswordText ”即可。那会做的事情

答案 1 :(得分:0)

我认为您需要为您的请求添加WS-Security配置。 阅读此http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html

请参阅“用户名”下的部分。然后在soapUI的testsuite中,确保添加刚刚创建的ws-security conf。这对我有用。

相关问题