标准流的方式接收xml数据

前端之家收集整理的这篇文章主要介绍了标准流的方式接收xml数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

接收数据:

request.setCharacterEncoding("UTF-8");
        response.setContentType("application/xml");

        //orderno 即shopOrder 中的 orderSn

        InputStream is = request.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
        StringBuffer sb = new StringBuffer();
        String line;
        while ((line = reader.readLine()) != null)
        {
            sb.append(line);
        }
        logger.info("notice_msg:" + sb.toString());

        //String xmlStr = sb.toString();

写入:
response.getWriter().write(errorXml("05","缺少设备ID信息(termid)"));

测试postman: raw

原文链接:https://www.f2er.com/xml/294205.html

猜你在找的XML相关文章