【发布时间】: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_RESPONSE或END_REQUEST,而不是两者(如果您以前使用过GET_RESPONSE,请使用END_RESPONSE)。 -
我试过只使用 end_response 没有运气。发生超时。
标签: spring plsql httprequest httpresponse spring-integration