I currently have a RestTemplate Response Object with String fields to get the Response data. I want to send InputStream in the same Object.
Below is the Response Class
@XmlRootElement
public class Test {
private Boolean success;
private String errorMessage;
private String exceptionMessage;
private String confirmation;
private InputStream attachment;
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
}
public String getConfirmation() {
return confirmation;
}
public void setConfirmation(String confirmation) {
this.confirmation = confirmation;
}
public InputStream getAttachment() {
return attachment;
}
public void setAttachment(InputStream attachment) {
this.attachment = attachment;
}
}
I'm using a post method as below.
Test test = restTemplate.postForObject(url,form,Test.class);
I'm getting the below error when passing the inputStream.
Could not write JSON: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer
Please advise.