Last post Mar 06, 2014 02:42 AM by Fuxiang Zhang - MSFT
Mar 03, 2014 06:50 PM|dotnetterAMG123|LINK
Hello, I'm trying to call an asmx web service from c# code. I know asmx is old school but that's the web service that's been provided to me. Anyway, I need to programatically call the web service from the plugin. My code is currently returning the following
"The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'."
Here's the code I'm using to try to call the asmx from the plugin:
private void Execute()
string svcUrl = "http://mycompany.com/services/external-service.asmx";
var svcClient = new mycompany.services.SwiVulnWriterSoapClient(Binding, new EndpointAddress(svcUrl));
svcClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
private WSHttpBinding GetBinding()
return new WSHttpBinding
Security = new WSHttpSecurity
Mode = SecurityMode.Message,
Transport = new HttpTransportSecurity
ClientCredentialType = HttpClientCredentialType.Windows
MaxReceivedMessageSize = 5242880
Can you recommend steps to resolve or troubleshoot this error?
Mar 06, 2014 02:42 AM|Fuxiang Zhang - MSFT|LINK
Thanks for the post.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'."
For the error message, I suggest you try to use the basicHttpBinding replace the wshttpbinding. And set the security like below.
<security mode="TransportCredentialOnly" >
<transport clientCredentialType="Windows" />
There are similar issues with practicable solutions, please check it.
Hope that helps, thanks.