![](/img/trans.png)
[英]Pass in username and password in an xml request to wcf service for authentication?
[英]Access wcf service with clientCredentialType=“UserName” using soapui
我有一個WCF服務,正在嘗試使用SoapUI訪問。 該服務運行良好,並且可以使用.net客戶端應用程序進行訪問,但無法弄清楚如何使用SoapUI訪問該服務。 在C#中,我像這樣指定客戶端的用戶名和密碼
var client = new xxxService.xxxServiceClient();
client.ClientCredentials.UserName.UserName = "xxxx";
client.ClientCredentials.UserName.Password = "xxxxx";
但是如何在soapui或xml中指定客戶端憑據
這是請求在soapui中的樣子
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
<soap:Body>
<tem:GetUsers/>
</soap:Body>
</soap:Envelope>
在soapUI的“導航器”窗口中,單擊您的WSDL項目。 第二個標簽“服務端點”列出了所有端點。 第二和第三列是用戶名和密碼。 在此輸入您的憑據。
您需要將WS-Security Configuration添加到您的請求中。 閱讀此http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html
並查看“用戶名”下的部分。 然后在soapUI的測試套件中,確保添加剛創建的ws-security conf。 那對我有用。
在“請求屬性”選項卡左下方的Soap UI中,雙擊“用戶名”和“密碼”並進行更改。 您仍在更改相同的選項卡“ WSS密碼類型” PasswordText時出錯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.