w0051977 w0051977 - 4 years ago 238
C# Question

Incorrect username and password with Basic Authentication

I am new to SOAPUI. So far; I have created the default WCF project in Visual Studio; published it to IIS and then tested it in SOAPUI. This worked as expected.

I am now trying to test a simple WCF Service, which uses Basic Authentication. I can test this WCF Service (with Basic Authentication) in a C# program as follows (this works as expected):

public Form1()
ServiceReference1.Service1Client s1 = new ServiceReference1.Service1Client();
s1.ClientCredentials.UserName.UserName = "testuser";
s1.ClientCredentials.UserName.Password = "testpassword";
string str = s1.GetData(1);


I am now trying to test this in SOAPUI. I have the following setup:

enter image description here

Note I have already right clicked and selected: Add WSS Username Token and selected: PasswordText.

I have also gone to: File/Preferences/HTTP Settings and selected: "adds authentication information to outgoing request".

What is the problem?

Answer Source

I have spent a long time trying to get the Auth window to work.

Instead I have done this, which works:

1.In the Request window, select the “Headers” tab on the bottom left.

2.Click the “+” button to add a header. The name of the header must be “Authorization.” Click OK.

3.In the value box, enter the word “Basic” plus the base64-encoded username:password. Use a base 64 encoder/decoder tool to create the base64 user:password string. For example, the Base64 version of “testuser:testpwd” is “dGVzdHVzZXI6dGVzdHB3ZA==” so the Value for the header would be Basic dGVzdHVzZXI6dGVzdHB3ZA==

I found the instructions here: http://www.ibm.com/support/knowledgecenter/SSPVUA_10.0.0/com.ibm.mdshs.esoatoolkit.doc/topics/t_esoatoolkit_createsoapUIhttpbasicauth.html

Here is a base64 encoder I used: https://www.base64encode.org/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download