Authentication Problem with Webservice

Discussion in 'Software' started by suddu, May 9, 2008.

  1. suddu

    suddu

    Joined:
    May 8, 2008
    Messages:
    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.ConfigurationManager.AppSettings["UserName"].ToString(), System.Configuration.ConfigurationManager.AppSettings["PassWord"].ToString());
    CredentialCache credCache = new CredentialCache(); //username and pwd from web.config
    credCache.Add(new Uri("http://xxx.com:xxxx/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.MessageSecurityException: 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 error:(401)Unauthorized. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.channels.HttpChannelFactory.HttpRequestChannel.HttpChannelReques.WaitForReply(TimeSpan timeout)

    thanks,,
    suddu, May 9, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KumarForG
    Replies:
    0
    Views:
    417
    KumarForG
    Apr 6, 2004
  2. KumarForG
    Replies:
    0
    Views:
    417
    KumarForG
    May 27, 2004
  3. jacksu
    Replies:
    0
    Views:
    404
    jacksu
    Feb 23, 2004
  4. jacksu
    Replies:
    0
    Views:
    399
    jacksu
    Feb 24, 2004
  5. Runner
    Replies:
    0
    Views:
    745
    Runner
    Oct 16, 2003
Loading...

Share This Page