0
我試圖從PLSQL發送一個http請求。它工作正常。發送來自PLSQL的http請求,由Spring Integration接收並答覆
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?
感謝您的幫助!
我不知道它的問題,但[在DOC給出的實例]的(http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_http.htm#i1013177)只有兩種'END_RESPONSE'或'END_REQUEST',而不是兩者(如果您以前使用過'GET_RESPONSE',則使用'END_RESPONSE')。 – 2012-07-12 08:30:56
我試過只用end_response沒有運氣。超時發生。 – 2012-07-12 09:26:09