|
@@ -23,25 +23,14 @@ public class GetWxOrderno {
|
|
*/
|
|
*/
|
|
public static Object getPayNo(String url,String xmlParam){
|
|
public static Object getPayNo(String url,String xmlParam){
|
|
try {
|
|
try {
|
|
-
|
|
|
|
-
|
|
|
|
-System.out.println("getPayNo start....");
|
|
|
|
-
|
|
|
|
String jsonStr = HttpClient431Util.doPostContent(xmlParam, "application/json", url);
|
|
String jsonStr = HttpClient431Util.doPostContent(xmlParam, "application/json", url);
|
|
//判断
|
|
//判断
|
|
- if(jsonStr.indexOf("FAIL")!=-1){
|
|
|
|
- WxPrepayIdErrorResult errorResult = (WxPrepayIdErrorResult) MessageUtil.xmlToBean(jsonStr, WxPrepayIdErrorResult.class);
|
|
|
|
-
|
|
|
|
-System.out.println("getPayNo errorResult...." + jsonStr);
|
|
|
|
-
|
|
|
|
- return errorResult;
|
|
|
|
|
|
+ assert jsonStr != null;
|
|
|
|
+ if(jsonStr.contains("FAIL")){
|
|
|
|
+ return (WxPrepayIdErrorResult) MessageUtil.xmlToBean(jsonStr, WxPrepayIdErrorResult.class);
|
|
}
|
|
}
|
|
Map map = doXMLParse(jsonStr);
|
|
Map map = doXMLParse(jsonStr);
|
|
- String prepay_id = (String) map.get("prepay_id");
|
|
|
|
-
|
|
|
|
-System.out.println("getPayNo end....");
|
|
|
|
-
|
|
|
|
- return prepay_id;
|
|
|
|
|
|
+ return (String) map.get("prepay_id");
|
|
} catch (Exception e1) {
|
|
} catch (Exception e1) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
e1.printStackTrace();
|
|
e1.printStackTrace();
|
|
@@ -136,6 +125,14 @@ System.out.println("getPayNo end....");
|
|
Map m = new HashMap();
|
|
Map m = new HashMap();
|
|
InputStream in = String2Inputstream(strxml);
|
|
InputStream in = String2Inputstream(strxml);
|
|
SAXBuilder builder = new SAXBuilder();
|
|
SAXBuilder builder = new SAXBuilder();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 防止XXE
|
|
|
|
+ builder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
|
|
|
+ builder.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
|
|
|
+ builder.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
|
|
|
+ builder.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
|
|
|
+
|
|
Document doc = builder.build(in);
|
|
Document doc = builder.build(in);
|
|
Element root = doc.getRootElement();
|
|
Element root = doc.getRootElement();
|
|
List list = root.getChildren();
|
|
List list = root.getChildren();
|