2015-03-13 37 views
0

我從JSON文件中讀取一些參數,併爲每個參數發送請求。 ,當我真正的移動輸出的任何元素我得到的錯誤:如何輸出tRESTClient

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    statusCode cannot be resolved or is not a field 
    string cannot be resolved or is not a field 
    body cannot be resolved or is not a field 
    The method getHeaders() is undefined for the type Response 

    at pricing.pricing_0_1.Pricing.tFileInputJSON_1Process(Pricing.java:3334) 
    at pricing.pricing_0_1.Pricing.tREST_1Process(Pricing.java:1783) 
    at pricing.pricing_0_1.Pricing.runJobInTOS(Pricing.java:4634) 
    at pricing.pricing_0_1.Pricing.main(Pricing.java:4366) 

enter image description here

回答

1

我有同樣的錯誤信息(也有JSON文件作爲輸入和輸出),我發現,解決辦法是將輸入,響應和錯誤模式留在它們最初在tRESTClient中擁有的結構中。 輸入模式包含正文和字符串。在這裏,您可以使用tXMLMap來定義正文結構(這不適用於我),也可以將帶有tMap的JSON文件作爲字符串直接發送到tRESTClient。 響應具有模式statusCode,正文和字符串。同樣,只需使用tMap和tLogRow檢索字符串即可獲得tRestClient的輸出。 我希望這可以幫助。

-2

我也得到了同樣的錯誤,我碰到的是因爲trestclient期待stausCode,body和String形式的模式輸入。 而輸入是作爲模式的鍵和值對提供的。所以我們得到的錯誤爲enter image description here

所以我使用了一個tconvertType並將tconverttype的輸出行轉換爲stausCode,body和String,並且它開始工作。 enter image description here

並且所有的錯誤都消失了。

感謝,

+0

中的StatusCode可變這篇文章並不適用於主要的問題在這個線程。 – 2016-09-07 19:01:22

1

包括在JSON

+1

您能否提供代碼示例? – Eugene 2015-10-26 20:15:53