2015-10-16 43 views
0

我想使用spring xd從Web服務使用HTTP/1.1協議來獲取text/xml響應。目標是將xml響應轉換爲json並插入到mongodb中。但現在我無法從流中獲得任何迴應。我想這樣做編程,而不是在殼,下面是我的代碼Spring xd流web服務響應

public static void main(String[] args) { 
     SpringXDTemplate template = null; 
     try { 
      template = new SpringXDTemplate(new URI("http://localhost:9393")); 
     } catch (URISyntaxException e) { 
      e.printStackTrace(); 
     } 
     String name = "test"; 
     String definition = "time --fixedDelay=5 | http-client --url='''http://www.ctabustracker.com/bustime/api/v2/getvehicles?key=key&vid=1''' | file"; 
     template.streamOperations().destroy(name); 
     template.streamOperations().createStream(name, definition, true); 
} 

我希望找到寫入到C的響應:\ tmp目錄\ XD \輸出\ test.out但沒有創建文件。我看到這個流是在admin ui中創建的,我沒有看到任何異常。如何獲得將請求發送到此URL的響應?

回答

0

打開DEBUG日誌;你應該看到時間源每5秒發出一條消息;通過流程中的消息來找出發生了什麼問題。

+0

謝謝,我忘了關於春天xd服務器上的日誌我只是從測試的輸出中尋找控制檯中的東西。我沒有在定義中提供--httpMethod = GET,並且它默認爲POST。 – gary69