Retrofit Android Base64 @Body
Olá a todos. Eu tenho esse código no Android 4.3 e agora estou usando o retrofit, mas o servidor me enviou uma mensagem de erro "A entrada não é uma string Base-64 válida, pois contém um caractere 64 não-base, mais de dois caracteres de preenchimento, ou um caractere ilegal entre os caracteres de preenchimento ". Quando estou usando o retrofit
//Normal HttpClient
//Base64 String
photo = new String(b);
// Creating HTTP client
HttpClient httpClient = new DefaultHttpClient();
// Creating HTTP Post
HttpPut httpPut = new HttpPut("http://beta2.irealtor.api.iproperty.com.my.ipga.local/PhotoService/"
+ mPropertyId + "/testWatermark"
);
httpPut.setHeader("content-type", "application/x-www-form-urlencoded");
httpPut.setHeader("Authorization","WFdSeW8vTJ1Z3oQlBJMk53VGpaekZRY2pCd1pYSlVXU090");
httpPut.setHeader("Accept", "application/json");
httpPut.setEntity(new StringEntity(photo, "utf-8"));
HttpResponse response = httpClient.execute(httpPut);
//With retrofit
@Headers({
"content-type:application/x-www-form-urlencoded"
})
@PUT("/PhotoService/{PROPERTYID}/{WATERMARK}") String uploadPhoto(
@Body String photo,
@Path("PROPERTYID") String propertyId,
@Path("WATERMARK") String watermark);