没有收到回复。请求无法打开或请求超时(对于POST请求)

时间:2012-08-02 16:18:13

标签: web-services rest post restful-url poster

我有一个请求,当我使用POSTMAN和POSTER插件点击服务时工作正常,但是当我尝试点击负载平衡网址时,我收到了错误。

海报中的错误(插件):

enter image description here

POSTMAN中的错误(插件):

enter image description here

部分代码:

@Path( "/" )
public class Check {
     public ResultSet rs;

     @POST
     @Produces( MediaType.TEXT_PLAIN )
     @Consumes( "application/xml" )
     public String validate( String xmlContent ) throws Exception {
          String value = "no";
          String result = null;
          Boolean inputCheck;

          Contents unmarshalledValues = unmarshalingContent( xmlContent );

MIME类型详细信息:

嗯,xml的MIME类型

http://annevankesteren.nl/2004/08/mime-types

使用XML的示例

http://docs.oracle.com/javaee/6/tutorial/doc/gkknj.html

2 个答案:

答案 0 :(得分:1)

你好@MadD可以尝试这样,

@Path("/upload")
public class Check {

     @POST
     @Consumes(MediaType.APPLICATION_OCTET_STREAM)
     public Response validate(InputStream input) {
           ...
           return Response.ok().build();
     }
     ...
}

希望这些有所帮助。

答案 1 :(得分:0)

好吧,我有非marshaller xml的JAXRS,所以我删除了

@Consumes 

它有效:)