How can I send gzip data as part of body using restclient or postman?. I used apache restclient 3.2.2 also couldn't able to get the response. I have attached images for reference.
Basically I have an xml file, want to convert it to gzip first and then send as part of body.
To convert to GZip I used online tools to first convert my xml file to gzip and included the converted gzip file as part of body in my restclient.
I got following java code and with code I'm getting response properly. But not able to get it working in restclient tool! !restclient body
URL url = new URL(String.format("%s?tid=%d", sessionInfo._getMessagesUrl, tpegId)); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type","application/octet-stream"); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); // Convert XML to initial binary payload. byte[] bytesToSend = getMessagesRequestXml.getBytes("UTF-8"); String fileName = "C:\\\\Sanjay\\\\Work\\\\17MM\\\\MM17_body.txt"; if (this._outputFilename != null) { System.out.println(String.format("\nWriting body file '%s'", fileName)); FileOutputStream s = new FileOutputStream(fileName); s.write(bytesToSend); s.close(); } dumpBinary("Original GetMessages request", bytesToSend); // Optionaly compress if (this._shouldCompress) { byte[] gzippedBytes = compressToGzip(bytesToSend); bytesToSend = gzippedBytes; dumpBinary("Compressed GetMessages request", bytesToSend); } // Optionally encrypt if (sessionInfo._encryptionKey != null) { byte[] encryptedBytes = encrypt(bytesToSend, sessionInfo._encryptionKey); bytesToSend = encryptedBytes; dumpBinary("Encrypted GetMessages request", bytesToSend); } // Send request System.out.println(String.format("Sending GetMessages Request: %s\n", url.toString())); DataOutputStream os = new DataOutputStream( connection.getOutputStream()); os.write(bytesToSend, 0, bytesToSend.length); os.flush(); os.close();