【问题标题】:No response was received. Either the request could not be opened or the request timed out ( for POST request )没有收到任何回应。请求无法打开或请求超时(对于 POST 请求)
【发布时间】:2012-08-02 16:18:12
【问题描述】:

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

POSTER 中的错​​误(插件):

POSTMAN 中的错误(插件):

部分代码:

@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

【问题讨论】:

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


    【解决方案1】:

    嗨@MadD,你可以这样尝试吗,

    @Path("/upload")
    public class Check {
    
         @POST
         @Consumes(MediaType.APPLICATION_OCTET_STREAM)
         public Response validate(InputStream input) {
               ...
               return Response.ok().build();
         }
         ...
    }
    

    希望这些有所帮助。

    【讨论】:

      【解决方案2】:

      好吧,我有 JAXRS 来解组 xml,所以我删除了

      @Consumes 
      

      成功了:)

      【讨论】:

        猜你喜欢
        • 2021-11-06
        • 1970-01-01
        • 2011-02-26
        • 1970-01-01
        • 2019-09-10
        • 2011-11-30
        • 2018-08-03
        • 1970-01-01
        • 2014-10-18
        相关资源
        最近更新 更多