【问题标题】:sending http request from PLSQL, receiving it by Spring Integration and replying从 PLSQL 发送 http 请求,由 Spring Integration 接收并回复
【发布时间】:2012-07-12 07:07:46
【问题描述】:

我正在尝试从 PLSQL 发送一个 http 请求。它工作正常。

HttpRequest := UTL_HTTP.BEGIN_REQUEST (url => v_http_url, METHOD => 'POST');
utl_http.set_header(HttpRequest, 'Content-Type', 'text/xml; charset=utf-8' );
utl_http.set_header(HttpRequest, 'Content-Length', 64);
utl_http.write_line(HttpRequest, 'some string');
Httpresp := utl_http.get_response(HttpRequest);
utl_http.end_request(HttpRequest);
utl_http.end_response(Httpresp);

Spring 集成方面:

<int:channel id="inputChannel" />
<int:channel id="outputChannel" />

<int-http:inbound-gateway request-channel="inputChannel"
    reply-channel="outputChannel" supported-methods="POST" name="/req"
    message-converters="MyRequestConverter"
    request-payload-type="MyRequest">
</int-http:inbound-gateway>

<int:service-activator input-channel="inputChannel"
    method="getMessage" ref="dbmock"></int:service-activator>

我用方法创建了 MyRequestConverter:

MyRequest readInternal(Class<? extends MyRequest > _class, HttpInputMessage message) throws IOException
void writeInternal(MyRequest request, HttpOutputMessage message)

我的服务方法如下:

public Object getMessage(@Headers Map<String, Object> headers, @Payload MyRequest payload)

问题是 PLSQL 站点没有得到响应 - 它无休止地等待。当我评论时

Httpresp := utl_http.get_response(HttpRequest)

PLSQL 过程成功执行。此外,我得到的例外是 java.lang.String 没有转换器。

有什么方法可以反向使用 MyRequestConverter 吗?

感谢您的帮助!

【问题讨论】:

  • 我不知道这是否重要,但examples given in the doc 只有END_RESPONSEEND_REQUEST,而不是两者(如果您以前使用过GET_RESPONSE,请使用END_RESPONSE)。
  • 我试过只使用 end_response 没有运气。发生超时。

标签: spring plsql httprequest httpresponse spring-integration


【解决方案1】:

您将内容长度设置为 64,但仅发送 11 个字节。服务器正在等待更多数据。

【讨论】:

  • 谢谢!我不知道它有那么重要。
猜你喜欢
  • 2014-02-24
  • 1970-01-01
  • 2013-09-29
  • 2016-11-24
  • 2011-03-03
  • 1970-01-01
  • 1970-01-01
  • 2015-12-26
  • 1970-01-01
相关资源
最近更新 更多