Hello
I'm trying to establish a connection, but var httpResponse = (HttpWebResponse) httpWebRequest.GetResponse(); I get the following error in the line of code:The remote server returned an error: (500) Internal Server Error
I was unable to resolve this error
My codes are :
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
string base64 = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "kortmazsefa", "xxxxxx")));
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://dev.gittigidiyor.com:8080/listingapi/ws/CategoryService?wsdl");
httpWebRequest.Headers.Add("Authorization", "Basic "+ base64);
httpWebRequest.ContentType = "text/xml";
httpWebRequest.Method = "POST";
XmlDocument requestXml = new XmlDocument();
requestXml.LoadXml("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cat=\"http://category.anonymous.ws.listingapi.gg.com\">" +"<soapenv:Header/>" +"<soapenv:Body>" +"<cat:getCategories>" +"<startOffSet>0</startOffSet>" +"<rowCount>4</rowCount>" +"<withSpecs>true</withSpecs>" +"<lang>tr</lang>" +"</cat:getCategories>" +"</soapenv:Body>" +"</soapenv:Envelope>");
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
requestXml.Save(streamWriter);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
}
}
catch (Exception e)
{
Response.Write(e);
}