Hi,
I'm developing a client software in windows forms c# that retrieves a config item providing his ID.
The webservice responses great and give me the information that i need only in debugger, however the c# application triggers a error:
in this line var response = httpWebReq.GetResponse();
'The underlying connection was closed: The connection was closed unexpectedly.'
here is my code:
var uri = new Uri("http://localhost/otrs/nph-genericinterf ... vice/teste");
var httpWebReq = (HttpWebRequest)WebRequest.CreateDefault(uri);
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
httpWebReq.ProtocolVersion = HttpVersion.Version10; // fix 1
httpWebReq.KeepAlive = false; // fix 2
httpWebReq.Timeout = 1000000000; // fix 3
httpWebReq.ReadWriteTimeout = 1000000000;
httpWebReq.KeepAlive = true;
string Path = @"some path file";
var bytePostData = File.ReadAllBytes(Path);
httpWebReq.Timeout = 5 * 1000;
httpWebReq.Method = "POST";
httpWebReq.ContentLength = bytePostData.Length;
httpWebReq.ContentType = "text/xml;charset=utf-8";
//httpWebReq.TransferEncoding=
//httpWebReq.ContentType = "application/xml";
//httpWebReq.Accept = "application/xml";
var dataStream = httpWebReq.GetRequestStream();
dataStream.Write(bytePostData, 0, bytePostData.Length);
dataStream.Close();
var response = httpWebReq.GetResponse();
hope guys u can help me.
Sorry my English
WebService c# OTRS Integration
Moderator: crythias
-
- Znuny newbie
- Posts: 3
- Joined: 04 Apr 2018, 12:35
- Znuny Version: 6.0.6