当前位置: 动力学知识库 > 问答 > 编程问答 >

web services - 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

网友答案:

Hard to know for sure but in the header tab of your poster tool add a header called accept and set it to application/xml.

分享给朋友:
您可能感兴趣的文章:
随机阅读: