我正在尝试从 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 吗?
谢谢你的帮助!