from_data参数放在body里 调用接口

postman里调用的参数

 

     MultiValueMap<String, String> body= new LinkedMultiValueMap<>();
        body.add("xm",xm);
        body.add("zjhm",zjhm);
        body.add("reqid","1");

       // String bodyJsonData = JSON.toJSONString(body);

        HttpEntity<MultiValueMap<String, String>> requestParams = new HttpEntity<>(body, headers);
        ResponseEntity<String> response = restTemplate.postForEntity(serverURL,requestParams,String.class);
        String result =response.getBody();

        System.out.println("result----"+result);
        JSONObject str=JSONObject.parseObject(result);
        String resultCode = str.getString("code");

 

posted @ 2022-05-17 11:09  百事没事  阅读(199)  评论(0编辑  收藏  举报