I have two Rest Webservice applications where WS1 is calling WS2 to get the PDF file in byte[] encoded format as given below. The WS1 application needs to get the actual decoded byte[] from response of WS2. Can some one please help me to get the required byte[].
Method 2 in Webservice 2 to return pdf in encoded byte format:
byte [] byteArr = // PDF file converted to byte Array
return Response.ok(byteArray, MediaType.APPLICATION_OCTET_STREAM)
.header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"" ) //optional
.build();
Method 1 in Webservice 1 to call method 2 in WS2 and procees and upload byte Array[PDF] to Server
ResponseEntity<String> response = //Rest call to method 2 in WS app 2
byte[] pdfByte = ??
//Code to process Byte Array