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);
}
}


Reply With Quote
Bookmarks