Hello guys,
I have the following problem ...
I'm trying to send an XML file via Post
I've tried several different ways , but all forms I always get the same error .
follows my last code and the error I'm getting ...
HttpWebRequest request = ( HttpWebRequest ) WebRequest.Create ( new Uri ( URI ) ) ;
request.method = " POST " ;
request.ContentType = " application / xml " ;
request.Accept = " application / xml " ;
byte [ ] bytes = Encoding.UTF8.GetBytes ( dadosOficiais ) ;
request.ContentLength = bytes.Length ;
// Error here....
using ( Stream putStream request.GetRequestStream = ( ) )
{
putStream.Write ( bytes , 0, bytes.Length );
}
// Log the response from Redmine RESTful service
using ( HttpWebResponse response = ( HttpWebResponse ) request.GetResponse ( ) )
using ( StreamReader reader = new StreamReader ( response.GetResponseStream ( ) ) )
{
}
The error I'm getting is
TimeOut :
ex {System.Net.WebException: Error: ConnectFailure (Connection timed out) ---> System.Net.Sockets.SocketException: Connection timed out at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0 at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0 at SpeedyBoy.Moip.EnviarPagamento () [0x000bd] in /Users/Paulo/Documents/GitHub/SpeedyBoy/Mobile-Android/SpeedyBoy/SpeedyBoy/Classes/Utils/Moip.cs:49 } System.Net.WebException
To have idea what I'm trying to make an example follows :