Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 5 of 5

Thread: Authentication failure - No "Authorization: Basic" header

  1. #1
    Junior Member
    Join Date
    Jul 2004
    Posts
    1

    Default Authentication failure - No "Authorization: Basic" header

    Hello,

    Can anyone help with "Authentication failure - No "Authorization: Basic" header was supplied, or it contained a zero-length userid"?

    I'm not too familiar with C# and would appreciate any help.
    Also, I was able to successfully retrieve an incident record via .NET WebService Studio.

    Log file :

    4360 03/16/2009 15:53:56 Authentication failure - No "Authorization: Basic" header was supplied, or it contained a zero-length userid
    4360 03/16/2009 15:53:56 Exception occurred for method Retrieve and XML request <RetrieveIncidentRequest xmlns="http://servicecenter.peregrine.com/PWS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" ><model><keys query=""><number>IM01009910</number></keys></model></RetrieveIncidentRequest>
    4360 03/16/2009 15:53:56 soap_serve - Caught XML API exception scxmlapi(20) - Authentication failure
    4360 03/16/2009 15:53:56 Sending 401 Not Authorized challenge

    C# code :

    using System;
    using System.IO;
    using System.Net;
    using System.Text;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using System.Web.UI;
    using Project1.IncidentManagement;

    public class MainClass
    {
    public static void Main(string[] args)
    {
    System.Console.WriteLine("Program started...");

    //Web Service credentials
    String username = "FALCON";
    String password = "#######";

    IncidentManagement incidentManagement = new IncidentManagement();

    // Create a new instance of CredentialCache.
    CredentialCache credentialCache = new CredentialCache();

    // Create a new instance of NetworkCredential using the client credentials.
    NetworkCredential credentials = new NetworkCredential(username, password, null);

    // Add the NetworkCredential to the CredentialCache.
    credentialCache.Add(new Uri(incidentManagement.Url), "Basic", credentials);

    // Add the CredentialCache to the proxy class credentials.
    incidentManagement.Credentials = credentialCache;
    incidentManagement.PreAuthenticate = true;

    RetrieveIncidentRequest retrieveIncidentRequest = new RetrieveIncidentRequest();
    IncidentModelType model = new IncidentModelType();
    IncidentKeysType keys = new IncidentKeysType();
    StringType number = new StringType();

    number.type = "String";
    number.mandatory = false;
    number.mandatorySpecified = false;
    number.@readonly = false;
    number.readonlySpecified = false;
    number.Value = "IM01009910";
    keys.number = number;
    keys.query = "";
    model.keys = keys;
    retrieveIncidentRequest.model = model;

    RetrieveIncidentResponse retrieveIncidentResult = incidentManagement.RetrieveIncident(retrieveIncide ntRequest);

    }
    }

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    19

    Default

    Ive tried each of the c# examples and everytime I get the error "IncidentManagement is a namespace but used like a type". can someone please please help? Ive added the using namespace and web reference.

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    22

    Default Same problem

    I have the same problem trying to interface PHP with SC !
    Did you find how to do the authentication ?
    someone knows what exactly we need to do to get the correction authentication.

    Thxx

  4. #4
    Junior Member
    Join Date
    Oct 2009
    Posts
    9

    Default

    Guys,

    I don't use C# or PHP, instead I use Java, and I had the same problem. How I resolved was adding the needed parameters for authentication, for example, in Axis you have a class to define these parameters. I suppose .NET and PHP may have the analog to set username and password.

    Don't forget associate the authentication class to the request.

  5. #5
    Junior Member
    Join Date
    Feb 2008
    Posts
    2

    Default

    I had to compile the code using Visual Studio 2003. Then the namespace error will go away.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts