2015-03-13 57 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