简体   繁体   中英

Java @POST Webservice 415 Unsupported Media Type

I have read through all the other posts, but seem to be getting this issue not sure why:

JAVA:

@Path("/acct")
public class MyService
{

    @Path("/create")
    @POST
    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public MyClass myClass( AccountForm aform ) throws exception
    {       
       System.out.println("MYtest");
    }
}

POSTER CLIENT: 在此处输入图片说明

I see this in the logs:

SEVERE: A message body reader for Java type, class AccountForm, and MIME media type, application/xml;charset=UTF-8, was not found

很难确定,但是在发布工具的标题选项卡中添加名为accept的标题并将其设置为application / xml。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM