@WebServlet("/ActionServlet")
public class PayWxOrderingReqCBS extends HttpServlet {

public PayWxOrderingReqCBS() {
        super();
    }

/**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
         doPost(request, response);
    }

/**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
     
        String msg = "success";
        response.setContentType("text/xml");    
        System.out.print("微信支付回调数据开始");        
        String inputLine;
        String notityXml = "";
        String resXml = "";

try {
            while ((inputLine = request.getReader().readLine()) != null) {
                notityXml += inputLine;
            }
            request.getReader().close();
        } catch (Exception e) {
            e.printStackTrace();
        }

System.out.println("接收到的报文:" + notityXml);     
        System.out.println("微信支付回调数据结束");
        System.out.println("告知服务端订单情况");
        String b = Xml2JsonUtil.xml2JSON(notityXml);
        System.out.println("=======================>"+b);
        try {
            JSONObject c = new JSONObject(b);
            String d = c.get("xml").toString();
            JSONObject e = new JSONObject(d);
            String f = e.get("return_code").toString();
            if (f.contains("SUCCESS")) {
                /** 告知订单状态,修改订单状态 */
               具体业务               
                
            }
        } catch (JSONException e) {          
            e.printStackTrace();
        } catch (SwordBaseCheckedException e) {         
            e.printStackTrace();
        }
        resXml = "<xml>" + "<return_code><![CDATA[SUCCESS]]></return_code>"
                + "<return_msg><![CDATA[OK]]></return_msg>" + "</xml> ";
        BufferedOutputStream out = new BufferedOutputStream(
                response.getOutputStream());
        out.write(resXml.getBytes());
        out.flush();
        out.close();

 response.getWriter().println(msg);

}

最新文章

  1. 重走java---Step 1
  2. nyoj814_又见拦截导弹_DP
  3. Juniper SRX防火墙-NAT学习笔记!
  4. Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum 离线+线段树
  5. scrollerView 轮番图
  6. Oracle安装时忘记解锁scott用户的解决方案
  7. verilog 双向IO实现
  8. web从入门开始(6)-----框架
  9. IDisposeable,Close
  10. chorme调试Paused in debugger问题解决
  11. jQuery监听事件经典例子
  12. SpringBoot入门教程(四)MyBatis generator 注解方式和xml方式
  13. springboot情操陶冶-jmx解析
  14. Linux 动态加载共享库
  15. 【分享】谈CSS3中display属性的flex布局
  16. 如何使用tensorboard查看tensorflow  graph****.pb文件的模型结构
  17. Linux sleep 语句以及循环 测试负载
  18. openMP多线程编程
  19. CRM WEB UI 01 BOL向导创建的搜索
  20. JAVA框架 SpringMVC RequestMapping讲解

热门文章

  1. 关于CLR、CIL、CTS、CLS、CLI、BCL和FCL
  2. Liunx下的系统负荷
  3. kali 下文件操作
  4. 利用Socket远程发送文件
  5. 移动端 触摸事件 ontouchstart、ontouchmove、ontouchend、ontouchcancel
  6. 纯html、css3、js的时钟
  7. Jquery EeasyUI等框架中图标的处理方法
  8. Android 监听返回键、HOME键
  9. rabbimq连接问题处理
  10. 测试 Prism 语法高亮