Java 修改端点以接收XML文件

Java 修改端点以接收XML文件,java,xml,rest,servlets,endpoint,Java,Xml,Rest,Servlets,Endpoint,我正在使用Postman将xml文件作为“表单数据”选项下的附加文件发送。 我正在将“内容类型”的请求头添加为“多部分/表单数据” 但是我的端点没有获取xml文件。我的端点如何接收xml文件 @PUT @Path("/{param1}/{param2}") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_JSON) public Response receiveXmlFile(List<Identi

我正在使用Postman将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();
    }
}
@PUT
@路径(“/{param1}/{param2}”)
@使用(MediaType.APPLICATION_XML)
@产生(MediaType.APPLICATION_JSON)
公共响应receiveXmlFile(列表标识符列表,
@PathParam(“param1”)字符串param1,
@PathParam(“param2”)字符串param2,
@FormParam(“xmlFile”)文件(xmlFile)
)
{
试一试{
返回Response.status(Response.status.OK).entity(readXmlFile(xmlFile)).build();
}捕获(例外e){
返回Response.status(Response.status.INTERNAL_SERVER_ERROR).header(“ERROR”,e.getMessage()).build();
}
}

解决方案是不从邮递员处发送
多部分/表单数据
标题

当发送相同的请求但没有任何头时,my endpoint成功接收到该文件