收藏
回答

微信第三方提交小程序,报错47001?

ext_json 打印如下:

{\"ext\":{},\"networkTimeout\":{},\"directCommit\":false,\"extAppid\":\"wx09790aaa217db4b6\",\"tabBar\":{\"backgroundColor\":\"#fff\",\"color\":\"#646464\",\"selectedColor\":\"#47ad34\",\"list\":[{\"selectedIconPath\":\"images/tab-f01-on.png\",\"text\":\"\u9996\u9875\",\"pagePath\":\"pages/index/index\",\"iconPath\":\"images/tab-f01.png\"},{\"selectedIconPath\":\"images/tab-f02-on.png\",\"text\":\"\u5206\u7C7B\",\"pagePath\":\"pages/fenlei1/fenlei1\",\"iconPath\":\"images/tab-f02.png\"},{\"selectedIconPath\":\"images/tab-f03-on.png\",\"text\":\"\u8D2D\u7269\u8F66\",\"pagePath\":\"pages/shopCar/shopCar\",\"iconPath\":\"images/tab-f03.png\"},{\"selectedIconPath\":\"images/tab-f04-on.png\",\"text\":\"\u6211\u7684\",\"pagePath\":\"pages/userCenterMall/userCenterMall\",\"iconPath\":\"images/tab-f04.png\"}]},\"extPages\":{},\"window\":{\"navigationBarBackgroundColor\":\"#fff\",\"navigationBarTitleText\":\"WeChat\",\"navigationBarTextStyle\":\"black\",\"backgroundTextStyle\":\"light\"},\"extEnable\":true}

查了好久了,不知道哪里有问题!求大婶们帮忙看看!

回答关注问题邀请回答
收藏

2 个回答

  • stop eating
    stop eating
    03-30

    doPosting的代码看一下。还有你这是一直有错,还是偶尔有错?

    03-30
    有用
    回复 8
    • Jahnke
      Jahnke
      03-30
      public static String doPostString(String url, String parameter) {
              CloseableHttpClient httpclient = HttpClients.createDefault();
              CloseableHttpResponse response = null;
              String ret = "";
              try {
                  HttpPost httpPost = new HttpPost(url);
                  HttpEntity entityReq = new StringEntity(parameter,
                          CharsetUtils.get("utf-8"));
                  httpPost.setEntity(entityReq);
                  httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
                  response = httpclient.execute(httpPost);
                  if (response.getStatusLine().getStatusCode() == 200) {
                      HttpEntity entity = response.getEntity();
                      ret = EntityUtils.toString(entity);
                      EntityUtils.consume(entity);
                      ret = new String(ret.getBytes("iso8859-1"), "utf-8");
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              } finally {
                  close(response, httpclient);
              }
              return ret;
          }
      03-30
      回复
    • Jahnke
      Jahnke
      03-30
      一直报错,没成功过,其他获取微信token的接口没问题。就这个提交小程序的目前没成功过!
      03-30
      回复
    • stop eating
      stop eating
      03-30回复Jahnke
      这就是不是json啊
      03-30
      回复
    • Jahnke
      Jahnke
      03-30
      改成了application/json;charset=UTF-8 也不行   现在post传的参数如下:{
          "access_token":"31_****",
          "user_version":"v1.0.1",
          "user_desc":"团购小程序",
          "ext_json":"{"ext":{},"networkTimeout":{},"directCommit":false,"extAppid":"wx09790aaa217db4b6","tabBar":{"backgroundColor":"#fff","color":"#646464","selectedColor":"#47ad34","list":[{"selectedIconPath":"images/tab-f01-on.png","text":"首页","pagePath":"pages/index/index","iconPath":"images/tab-f01.png"},{"selectedIconPath":"images/tab-f02-on.png","text":"分类","pagePath":"pages/fenlei1/fenlei1","iconPath":"images/tab-f02.png"},{"selectedIconPath":"images/tab-f03-on.png","text":"购物车","pagePath":"pages/shopCar/shopCar","iconPath":"images/tab-f03.png"},{"selectedIconPath":"images/tab-f04-on.png","text":"我的","pagePath":"pages/userCenterMall/userCenterMall","iconPath":"images/tab-f04.png"}]},"extPages":{},"window":{"navigationBarBackgroundColor":"#fff","navigationBarTitleText":"WeChat","navigationBarTextStyle":"black","backgroundTextStyle":"light"},"extEnable":true}",
          "template_id":"1"
      }
      03-30
      回复
    • stop eating
      stop eating
      03-30回复Jahnke
      反正就是你代码不对,我现在用的okhttp,代码比httpclient少
      03-30
      回复
    查看更多(3)
  • Jahnke
    Jahnke
    03-30

    格式化的代码:

    {

        "ext":{


        },

        "networkTimeout":{


        },

        "directCommit":false,

        "extAppid":"wx09790aaa217db4b6",

        "tabBar":{

            "backgroundColor":"#fff",

            "color":"#646464",

            "selectedColor":"#47ad34",

            "list":[

                {

                    "selectedIconPath":"images/tab-f01-on.png",

                    "text":"首页",

                    "pagePath":"pages/index/index",

                    "iconPath":"images/tab-f01.png"

                },

                {

                    "selectedIconPath":"images/tab-f02-on.png",

                    "text":"分类",

                    "pagePath":"pages/fenlei1/fenlei1",

                    "iconPath":"images/tab-f02.png"

                },

                {

                    "selectedIconPath":"images/tab-f03-on.png",

                    "text":"购物车",

                    "pagePath":"pages/shopCar/shopCar",

                    "iconPath":"images/tab-f03.png"

                },

                {

                    "selectedIconPath":"images/tab-f04-on.png",

                    "text":"我的",

                    "pagePath":"pages/userCenterMall/userCenterMall",

                    "iconPath":"images/tab-f04.png"

                }

            ]

        },

        "extPages":{


        },

        "window":{

            "navigationBarBackgroundColor":"#fff",

            "navigationBarTitleText":"WeChat",

            "navigationBarTextStyle":"black",

            "backgroundTextStyle":"light"

        },

        "extEnable":true

    }

    03-30
    有用
    回复 1
登录 后发表内容
问题标签