Upload BIG files via HTTP

Thank you @Stoune, it was last thing that helped to receive finally working solution. One more, it is need to organize stream file reading and writing to the webrequest buffer. And it possibly to do with that piece of code: $requestStream = $webRequest.GetRequestStream() $fileStream = [System.IO.File]::OpenRead($file) $chunk = New-Object byte[] $bufSize while( $bytesRead = $fileStream.Read($chunk,0,$bufsize) … Read more

Using HttpWebRequest to POST data/upload image using multipart/form-data

I finally got it with the following code … var boundary = “————————” + DateTime.Now.Ticks; var newLine = Environment.NewLine; var propFormat = “–” + boundary + newLine + “Content-Disposition: form-data; name=\”{0}\”” + newLine + newLine + “{1}” + newLine; var fileHeaderFormat = “–” + boundary + newLine + “Content-Disposition: form-data; name=\”{0}\”; filename=\”{1}\”” + newLine; var … Read more

Asynchronous HTTP Client for Java

You have several choices for Async HTTP Clients in Java Java 8: Use the async-http-client formerly called ning http client library. Java 11 and above: JDK now comes with the java.net.http. HttpClient which is fully asynchronous. Square’s OkHttpClient. Supports both sync blocking and async calls with callbacks. Quite popular on Android.

Sending HTTP Post request with SOAP action using org.apache.http

This is a full working example : import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; public void callWebService(String soapAction, String soapEnvBody) throws IOException { // Create a StringEntity for the SOAP XML. String body =”<?xml version=\”1.0\” encoding=\”UTF-8\”?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\”http://schemas.xmlsoap.org/soap/envelope/\” xmlns:ns1=\”http://example.com/v1.0/Records\” xmlns:xsd=\”http://www.w3.org/2001/XMLSchema\” xmlns:xsi=\”http://www.w3.org/2001/XMLSchema-instance\” xmlns:SOAP-ENC=\”http://schemas.xmlsoap.org/soap/encoding/\” SOAP-ENV:encodingStyle=\”http://schemas.xmlsoap.org/soap/encoding/\”><SOAP-ENV:Body>”+soapEnvBody+”</SOAP-ENV:Body></SOAP-ENV:Envelope>”; StringEntity stringEntity = new StringEntity(body, “UTF-8”); … Read more

TLS 1.2 not negotiated in .NET 4.7 without explicit ServicePointManager.SecurityProtocol call

I had the same issue (Windows 10 and SSL3 / TLS only… not System Default) with a legacy app targeting 4.7.2. My issue was that during the upgrade process over the years we never added in the targetFramework to the system.web > httpRuntime element (Note: it did exist on system.web > compilation element). Before taking … Read more

Maximum concurrent requests for WebClient, HttpWebRequest, and HttpClient

Yes, there is a limit. The default connection limit is 2 concurrent connections per remote host. This can be overridden. For example, I believe that ASP.NET by default overrides the default to be 10 connections per remote host. From https://msdn.microsoft.com/en-us/library/7af54za5.aspx: The number of connections between a client and server can have a dramatic impact on … Read more