Cannot be logged in as GUEST [message #150277] |
Wed, 07 December 2005 00:04 |
manwadkar
Messages: 104 Registered: September 2005 Location: Washington DC
|
Senior Member |
|
|
I am trying to connect to the Oracle Application Server to upload a record of data, but getting an error saying that 'Cannot be logged in as GUEST.'
Connection to the Oracle Application Server is done using an HttpWebRequest.No exception is given by this code.
This is the piece of code in C# which i used to connect to Oracle Application Server via an external application.
This function is being called on a click of the button (event handler)
public Send_Click(object sender, System.EventArgs e)
{
string url = "http://serv0140bis.approva.int:8000/oa_servlets/oracle.apps.bne.integrator.upload.BneUploaderService?bne:encoding=UTF-8";
string sFileContent = "";
try
{
//using string containing data to upload
StreamReader reader = File.OpenText(@"C:\Inetpub\wwwroot\TestingOra\bin\inputNonImport.txt");
sFileContent = reader.ReadToEnd();
reader.Close();
HttpWebRequest req = (HttpWebRequest)System.Net.WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "multipart/form-data; boundary=---------------------------7d06f1de0452";
ASCIIEncoding encoding=new ASCIIEncoding();
byte[] byte1=encoding.GetBytes(sFileContent);
req.ContentLength = byte1.Length;
req.Timeout = 10000;
//Credential Settings
NetworkCredential nc = new NetworkCredential("neha","approva","serv0140bis.approva.int:8000");
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri(url),"Basic",nc);
req.Credentials = credentialCache;
req.PreAuthenticate = true;
req.CookieContainer = new CookieContainer();
req.CookieContainer.Add(req.RequestUri,commonCookies);
Stream s = req.GetRequestStream();
s.Write(byte1,0,byte1.Length);
s.Close();
System.Net.WebResponse resp = req.GetResponse();
Stream str = resp.GetResponseStream();
StreamReader sr = new StreamReader(str,System.Text.Encoding.UTF8);
string sResponses = sr.ReadToEnd();
TextBox1.TextMode = TextBoxMode.MultiLine;
TextBox1.Text = sResponses;
}
#region Catch blocks
catch(ProtocolViolationException pex)
{
int j = 0;
}
catch(WebException wex)
{
int j = 0;
}
catch(InvalidOperationException iex)
{
int j = 0;
}
catch(Exception ex)
{
int j = 0;
}
#endregion Catch blocks
NB:
inputNonImport.txt file contains the record to be uploaded.
The Response is displayed in TextBox1.
The Response displayed in the textbox is as follows:
<?xml version="1.0" encoding="UTF-8"?><bne:document xmlns:bne="http://www.oracle.com/bne"><bne:message bne:type="ERROR" bne:text="Cannot be logged in as GUEST." bne:cause="" bne:action="" /></bne:document>
|
|
|