Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Authentication Problem with Webservice

Thread Tools

Authentication Problem with Webservice

suddu suddu is offline
Junior Member
Join Date: May 2008
Posts: 1
Hi All,

this is the code which i am using to call a webservice in ASP.Net, which is working, but the same code is not working when called from C# windows application.

WebService.CustomerService CustObj = new WebService.CustomerService(); //object

NetworkCredential ntkCred = new NetworkCredential(System.Configuration.Configurati onManager.AppSettings["UserName"].ToString(), System.Configuration.ConfigurationManager.AppSetti ngs["PassWord"].ToString());
CredentialCache credCache = new CredentialCache(); //username and pwd from web.config
credCache.Add(new Uri("http://xxx.comxxx/CustomerService?wsdl=1.1" ), "Basic", ntkCred);
CustObj.Credentials = credCache;

CustObj.GetCustomerDetails("00000000", "", "Username", out objCust); //webservice function

in C# app,, i am unable to assign the credentialcache object to my webservice object like this CustObj.Credentials = credCache; in C#
the intellisence doesn't show the Credential method instead it shows a ClientCredentials property.

and this is the error:
System.ServiceModel.Security.MessageSecurityExcept ion: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.The authentication header received from the server was 'Basic realm="SAP Web Application Server [SAPDS]".--->System.Net .WebException: The remote server returned an error401)Unauthorized. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.channels.HttpChannelFactory.Ht tpRequestChannel.HttpChannelReques.WaitForReply(Ti meSpan timeout)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to call a WEBSERVICE in another WEBSERVICE (AXIS/ TOMCAT) Cyril Java 2 06-01-2006 06:07 PM
Problem! calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
Problem! calling nonsecure webservice from a secured ssl https webpage batista ASP .Net Web Services 0 01-26-2006 08:14 AM
Problem! calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 0 01-26-2006 08:13 AM
problem accessing webservice if enabling windows integrated authentication Jack Sharp ASP .Net Web Services 2 02-24-2004 04:31 PM