1
我使用Postman在“form-data”选项下以附件形式发送xml文件。 我加入的请求标头“内容类型”为“多/表单数据”修改端点以接收XML文件
但我的终点是没有得到的XML文件。我的端点如何接收xml文件?
@PUT
@Path("/{param1}/{param2}")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_JSON)
public Response receiveXmlFile(List<Identifier> identifierList,
@PathParam("param1") String param1,
@PathParam("param2") String param2,
@FormParam("xmlFile") File xmlFile)
)
{
try {
return Response.status(Response.Status.OK).entity(readXmlFile(xmlFile)).build();
} catch (Exception e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("error", e.getMessage()).build();
}
}