Solved

Webservice Error

  • 28 September 2020
  • 4 replies
  • 818 views

Badge +2

Hi All,

I am trying to integrate the Web service using C#.Net and I am getting below error, Is anyone has a clue to solve this?

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="myrealm"'.

icon

Best answer by pranay 1 October 2020, 13:38

View original

4 replies

Userlevel 4
Badge +8

Please can you give us some more information?

 

Your code would probably be helpful.

 

Please block out any credential/URL

Userlevel 7
Badge +20

Hi @pranay ,

Have you added  the Authorization header in the web request?

 

Auth header format in the http request

Authorization: Basic Base64Encode[USERNAME:PASSWORD]

/Damith

Badge +2

Hi @dsj  and @Mike.Hollifield ,

 

thanks for the reply,  I did solve it, I was using the wrong link of the REST APIs. and also it had a permissions issue.

 

Thanks,

Pranay

Userlevel 2
Badge +6

Hi @pranay,

 

When you instantiate a service object you sould use  username and password for basic auth.

  var service = new YourService.YourServiceClient();

  service.ClientCredentials.UserName.UserName = username;
  service.ClientCredentials.UserName.Password = password;
 

Also check your bindings security in App.config file.

 

        <binding name="YourServicePortBinding" >
                    <security mode="Transport">
                        <transport clientCredentialType="Basic" />
                    </security>
         </binding>     

 

It should be like above.

 

ridvan

 

 

 

 

 

Reply