我有一个 json 字符串,它是:
`{
"portfolio": "HEXGENFUND",
"transSrlNo": "1",
"transCode": "BUY",
"investReason": "004",
"inflowOutflow": "I",
"transDate": "2012-09-01",
"tradeDate": "2012-09-01",
"tradeDateUpto": "2012-09-01",
"tradeTime": "11:27:9",
"investCategory": "FVTPL",
"custodian": "DEUTSCHE",
"holdType": "HOLD",
"securityType": "INV",
"security": "DABU02",
"assetClass": "EQU",
"issuer": "DABU",
"marketType": "MKT",
"tradePriceType": "S",
"requisitionType": "SO",
"priceFrom": "100000",
"priceTo": "100000",
"marketPrice": "100000",
"averagePrice": "100000",
"price": "100000",
"quantity": "2",
"grossAmtTcy": "200000",
"exchRate": "1",
"grossAmtPcy": 200000,
"grossIntTcy": "0",
"grossIntPcy": 0,
"netAmountTcy": 200000,
"netAmountPcy": 200000,
"acquCostTcy": 200000,
"acquCostPcy": 200000,
"yieldType": "N",
"purchaseYield": "0",
"marketYield": "0",
"ytm": "0",
"mduration": "0",
"currPerNav": "0",
"desiredPerNav": "0",
"currHolding": "0",
"noofDays": "0",
"realGlPcy": 0,
"realGlTcy": "0",
"nowLater": "N",
"isAllocable": "false",
"acquCostReval": 0,
"acquCostHisTcy": 200000,
"acquCostHisPcy": 0,
"exIntTcy": 0,
"exIntPcy": 0,
"accrIntReval": 0,
"accrIntTcy": 0,
"accrIntPcy": 0,
"grossAodTcy": 0,
"grossAodPcy": 0,
"grossAodReval": 0,
"bankAccAmtAcy": 200000,
"bankAccAmtPcy": 200000,
"taxAmountTcy": 0,
"unrelAmortTcy": 0,
"unrelAmortPcy": 0,
"unrelGlTcy": 0,
"unrelGlPcy": 0,
"realGlHisTcy": 0,
"realGlHisPcy": 0,
"tradeFeesTcy": 0,
"tradeFeesPcy": 0
}`
我尝试通过httpclient调用采用上述参数的方法。当我调用如下方法时:
uri = "http://localhost:8080/api/trade/createrequisition";
HttpPost postURI = new HttpPost(uri);
postURI.setHeader("Content-type", "application/json");
// Setup the request parameters
BasicHttpParams params = new BasicHttpParams();
params.setParameter("CreateRequisitionRO", jsonROConverter.serialiseRequisionRO(request));
params.setBooleanParameter("validateOnly", validateOnly);
postURI.setParams(params);
HttpResponse responseURL = client.execute(postURI);
这就是所谓的方法的签名:
public @ResponseBody
void createRequisition(@RequestBody CreateRequisitionRO[] request,
@RequestHeader("validateOnly") boolean validateOnly) {....}
这是我得到的例外:
java.io.EOFException: No content to map to Object due to end of input
可能是什么问题呢。
请帮我解决这个问题。