【问题标题】:CXF EndPointImpl How to set a timeout in published endpointCXF EndPointImpl 如何在已发布的端点中设置超时
【发布时间】:2016-06-24 14:56:41
【问题描述】:

对不起,如果我的问题不是很清楚,我的问题很难解释。

所以,我是第一次使用 CXF 框架。我在网上搜索了一个解决方案,但没有成功。让我们解释一下用例。

我尝试编写一个 Web 服务(在服务器模式下)来接收 SOAP 消息、处理处理和应答。为此,我首先使用 CXF 和 WSDL 方法。

我的实现似乎运行良好,我通过我的实现类接收到带有注释“@webservice”的 SOAP 消息......处理这个请求并返回一个答案。 我的问题位于处理端 somethinme ,并且取决于 SOAP 消息,它可能非常长,在这种情况下,CXF 会处理超时。 所以,我想配置“超时”,让我可以进行这么长时间的处理

    EndpointImpl jaxWsEndpoint = (EndpointImpl) Endpoint.publish(endPointAddress, httpWebService);

对象httpWebService 代表“回调” 类。

【问题讨论】:

    标签: web-services soap wsdl timeout cxf


    【解决方案1】:

    您可以在配置级别使用ReceiveTimeout 来设置服务在连接超时之前尝试接收请求的时间长度(以毫秒为单位)。设置 0 表示不超时

      <http-conf:destination name="{http://apache.org/hello_world_soap_http}SoapPort.http-destination">
           <http-conf:server ReceiveTimeout="0" />
      </http-conf:destination>
    

    考虑到连接超时参数也可以在你的应用服务器配置中设置

    【讨论】:

    • 嗨@BrK,你检查了吗?
    【解决方案2】:

    如果你不想关注official way(取决于Spring),你可以试试这个:

    EndpointImpl ep = (EndpointImpl) endpoint;
    JettyHTTPDestination dest = (JettyHTTPDestination) ep.getServer().getDestination();
    JettyHTTPServerEngine se = (JettyHTTPServerEngine) dest.getEngine();
    AbstractConnector ac = (AbstractConnector) se.getConnector();
    ac.setIdleTimeout(0);
    

    【讨论】:

    • 抱歉耽搁了,不幸的是它不起作用.. :(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多