补充下XML的内容 [代码]<[代码][代码]xml[代码][代码]><[代码][代码]appid[代码][代码]>[代码][代码]<![CDATA[是正确的]]>[代码][代码]</[代码][代码]appid[代码][代码]>[代码][代码]<[代码][代码]mch_id[代码][代码]>[代码][代码]<![CDATA[是正确的]]>[代码][代码]</[代码][代码]mch_id[代码][代码]>[代码][代码]<[代码][代码]nonce_str[代码][代码]>[代码][代码]<![CDATA[201808101626400971]]>[代码][代码]</[代码][代码]nonce_str[代码][代码]>[代码][代码]<[代码][代码]notify_url[代码][代码]>[代码][代码]<![CDATA[https://www.netsupper.top/print/wx/payment/paynotify/refund]]>[代码][代码]</[代码][代码]notify_url[代码][代码]>[代码][代码]<[代码][代码]out_refund_no[代码][代码]>[代码][代码]<![CDATA[188AG2640X660000]]>[代码][代码]</[代码][代码]out_refund_no[代码][代码]>[代码][代码]<[代码][代码]out_trade_no[代码][代码]>[代码][代码]<![CDATA[188AF2642X660000]]>[代码][代码]</[代码][代码]out_trade_no[代码][代码]>[代码][代码]<[代码][代码]refund_desc[代码][代码]>[代码][代码]<![CDATA[退还赏金]]>[代码][代码]</[代码][代码]refund_desc[代码][代码]>[代码][代码]<[代码][代码]refund_fee[代码][代码]>[代码][代码]<![CDATA[1]]>[代码][代码]</[代码][代码]refund_fee[代码][代码]>[代码][代码]<[代码][代码]sign_type[代码][代码]>[代码][代码]<![CDATA[MD5]]>[代码][代码]</[代码][代码]sign_type[代码][代码]>[代码][代码]<[代码][代码]total_fee[代码][代码]>[代码][代码]<![CDATA[1]]>[代码][代码]</[代码][代码]total_fee[代码][代码]>[代码][代码]<[代码][代码]transaction_id[代码][代码]>[代码][代码]<![CDATA[]]>[代码][代码]</[代码][代码]transaction_id[代码][代码]>[代码][代码]</[代码][代码]xml[代码][代码]>[代码]
谁能给个微信退款的示例代码,httpclient不知道怎么提交退款的XML数据[代码]ByteArrayInputStream isc = [代码][代码]new[代码] [代码]ByteArrayInputStream(xml.getBytes());[代码][代码]//HttpEntity e = new InputStreamEntity(isc,ContentType.APPLICATION_XML);[代码][代码]//post.setEntity(e);[代码][代码]post.setEntity([代码][代码]new[代码] [代码]ByteArrayEntity(xml.getBytes()));[代码] xml是退款参数 InputStreamEntity 和 ByteArrayEntity都试过,一直返回 [代码]<[代码][代码]xml[代码][代码]><[代码][代码]return_code[代码][代码]>[代码][代码]<![CDATA[FAIL]]>[代码][代码]</[代码][代码]return_code[代码][代码]>[代码][代码]<[代码][代码]return_msg[代码][代码]>[代码][代码]<![CDATA[缺少参数]]>[代码][代码]</[代码][代码]return_msg[代码][代码]>[代码][代码]</[代码][代码]xml[代码][代码]>[代码] 下面的代码基本是抄官网的demo(官网也不提示的完整一些是怎么提交xml,还有到处查资料) [代码]/**[代码] [代码] [代码][代码]* 执行请求[代码][代码] [代码][代码]* @param xml 封装的参数[代码][代码] [代码][代码]* @return 返回执行结果[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]private[代码] [代码]String doSslRequest(String xml) {[代码][代码] [代码][代码]// Trust own CA and all self-signed certs[代码][代码] [代码][代码]CloseableHttpClient httpclient = [代码][代码]null[代码][代码];[代码][代码] [代码][代码]CloseableHttpResponse response = [代码][代码]null[代码][代码];[代码][代码] [代码][代码]HttpEntity httpEntity = [代码][代码]null[代码][代码];[代码][代码] [代码][代码]InputStreamReader entityStream = [代码][代码]null[代码][代码];[代码][代码] [代码][代码]try[代码] [代码]{[代码][代码] [代码][代码]char[代码][代码][] mchid = AppConfig.getPaymchId().toCharArray();[代码][代码] [代码][代码]KeyStore keyStore = getKeyStore(mchid);[代码][代码] [代码][代码]SSLContext sslcontext = SSLContexts.custom()[代码][代码] [代码][代码].loadKeyMaterial(keyStore, mchid).build();[代码][代码] [代码][代码]// Allow TLSv1 protocol only[代码][代码] [代码][代码]String[] tlsv1 = { [代码][代码]"TLSv1"[代码] [代码]};[代码][代码] [代码][代码]HostnameVerifier hostname = SSLConnectionSocketFactory.getDefaultHostnameVerifier();[代码][代码] [代码][代码]SSLConnectionSocketFactory sslsf = [代码][代码]new[代码] [代码]SSLConnectionSocketFactory([代码][代码] [代码][代码]sslcontext, tlsv1, [代码][代码]null[代码][代码], hostname);[代码][代码] [代码][代码]httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();[代码] [代码] [代码][代码]// HttpGet httpget = new HttpGet(D_URL_PAYREFUND);[代码][代码] [代码][代码]HttpPost post = [代码][代码]new[代码] [代码]HttpPost(D_URL_PAYREFUND);[代码][代码] [代码][代码]ByteArrayInputStream isc = [代码][代码]new[代码] [代码]ByteArrayInputStream(xml.getBytes());[代码][代码] [代码][代码]//HttpEntity e = new InputStreamEntity(isc,ContentType.APPLICATION_XML);[代码][代码] [代码][代码]//post.setEntity(e);[代码][代码] [代码][代码]post.setEntity([代码][代码]new[代码] [代码]ByteArrayEntity(xml.getBytes())); [代码][代码] [代码][代码]response = httpclient.execute(post);[代码][代码] [代码][代码]httpEntity = response.getEntity();[代码] [代码] [代码][代码]log.debug([代码][代码]"----------------------------------------"[代码][代码]);[代码][代码] [代码][代码]log.debug(response.getStatusLine().toString());[代码][代码] [代码][代码]if[代码] [代码](httpEntity == [代码][代码]null[代码][代码]) {[代码][代码] [代码][代码]log.error([代码][代码]"请求返回null"[代码][代码]);[代码][代码] [代码][代码]return[代码] [代码]null[代码][代码];[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]log.debug([代码][代码]"Response content length: "[代码][代码] [代码][代码]+ httpEntity.getContentLength());[代码][代码] [代码][代码]entityStream = [代码][代码]new[代码] [代码]InputStreamReader(httpEntity.getContent(),[代码][代码] [代码][代码]Tools.encode.UTF8);[代码][代码] [代码][代码]char[代码][代码][] buf = [代码][代码]new[代码] [代码]char[代码][代码][[代码][代码]1024[代码] [代码]* [代码][代码]16[代码][代码]];[代码][代码] [代码][代码]StringBuilder responseText = [代码][代码]new[代码] [代码]StringBuilder();[代码][代码] [代码][代码]int[代码] [代码]l;[代码][代码] [代码][代码]while[代码] [代码]((l = entityStream.read(buf)) != -[代码][代码]1[代码][代码]) {[代码][代码] [代码][代码]responseText.append(buf, [代码][代码]0[代码][代码], l);[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]return[代码] [代码]responseText.toString();[代码][代码] [代码][代码]} [代码][代码]catch[代码] [代码](Exception e) {[代码][代码] [代码][代码]log.error([代码][代码]"微信支付ssl请求出错"[代码][代码], e);[代码][代码] [代码][代码]throw[代码] [代码]new[代码] [代码]YMException([代码][代码]"微信支付ssl请求出错:"[代码] [代码]+ e.getMessage());[代码][代码] [代码][代码]} [代码][代码]finally[代码] [代码]{[代码][代码] [代码][代码]Tools.io.close(entityStream);[代码][代码] [代码][代码]close(httpEntity);[代码][代码] [代码][代码]Tools.io.close(response);[代码][代码] [代码][代码]Tools.io.close(httpclient);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码]
2018-08-10这是成功的,openid就是当前的微信用户{"touser":"oJvTq4ktOSAZTiZ4c9rjFCN47zRI","form_id":"1531137691868","template_id":"O6n4HxbvjTqqAZsbndBlT62LzOuGbziI1Wbs2KvXb1o" } 这是41028错误的 ,opnid是其他用户 {"touser":"oJvTq4r9YSoaHyugafscc_XzvrG0","form_id":"1531137590132","template_id":"O6n4HxbvjTqqAZsbndBlT62LzOuGbziI1Wbs2KvXb1o"} 用"oJvTq4r9YSoaHyugafscc_XzvrG0"的对应微信用户发送是成功的{"touser":"oJvTq4r9YSoaHyugafscc_XzvrG0","form_id":"1531137823936","template_id":"O6n4HxbvjTqqAZsbndBlT62LzOuGbziI1Wbs2KvXb1o"}
开发版的小程序发送模板消息,发给自己就成功,发给别人就41028开发版的小程序发送模板消息,为什么发给自己就成功,发给别人就 {"errcode":41028,"errmsg":"invalid form id hint: [QnS68a0297ge21]"} === 是不是有什么限制,看文档也没有说明啊?? 用两台手机试了两个openid,都是这情况
2018-07-09我也遇到同样的问题,怎么解决?
picker mode = region,强烈建议开放自定义省市区数据的功能@微信官方 省市区联动选择组件picker mode = region,能否开放一个属性,让我们可以传入自定义的省市区数据列表?因为我们之前已经有完全基于web-view组件开发了一个内嵌h5的小程序,用户的地址信息都是我们自己维护的省市区数据,现在我们要写一个原生的小程序,地址数据完全对不上,刚需,望回复!
2018-05-16