http post xml 表单提交(application/x-www-form-urlencoded)
来源:互联网 发布:it企业 编辑:程序博客网 时间:2024/06/05 09:52
http post xml 表单提交(application/x-www-form-urlencoded)
原报文
<rminfo>
<serialid>1</serialid>
<outserialid>SP1712011545899767809_171201152853818</outserialid>
<merserialid>1209681201712011377612234</merserialid>
<paycode>3</paycode>
<reinfo></reinfo>
<channelname>**</channelname>
<productid>1152</productid>
<productname>QQ钱包JSAPI支付</productname>
<payfinishedtime>2017-12-01 15:30:58</payfinishedtime>
<extdata>
<![CDATA[cardtype=1&cardtypedesc=储蓄卡]]>
</extdata>
<extxml>
<openid>
<![CDATA[51FCF7AB8495CC6AF1D83CF37DAEAF5D]]>
</openid>
<useraccount>
<![CDATA[YLiVd8NnAGa+CAk3HoJu7M4GEnula+WfQSqPUpCkD+2e6+k55wK/Qw==]]>
</useraccount>
<bankinfo>
<shortname>CITIC</shortname>
<bankname>中信银行</bankname>
<cardtype>储蓄卡</cardtype>
</bankinfo>
</extxml>
<projectorder>SP1712011524306335970445899767809</projectorder>
<projectcode>70</projectcode>
<financecode>081001144123040103187210044139115002056164073004</financecode>
<paymentcount>0</paymentcount>
<unionorder>SP1712011524306335970445899767809</unionorder>
<operationtype>1</operationtype>
<reduceamount></reduceamount>
<awardamount></awardamount>
<realamount>22.00</realamount>
<companycode>1</companycode>
<reqcompany>1</reqcompany>
<ver>0</ver>
<fromplat>11</fromplat>
</rminfo>
能解决报文中包含等号的问题
@ResponseBody
public String commonPayCallBack(@RequestBody String req){
BaseResponse response = new BaseResponse();
try{
String reqStr = URLDecoder.decode(req,"UTF-8");
CommonPayCallbackForm request = XmlSerializerHelper.deserialize(reqStr,CommonPayCallbackForm.class);
}catch(..){..}
}
CommonPayCallbackForm.java
@XSteamAlias("rminfo") //报文头结点
public class CommonPayCallbackFrom extends BaseRequest{
private static final long serialVersionUID = 1L;
@XStreamAlias("serialid") //报文原始值
private String SerialId; //转化后的值
@XStreamAlias("outserialid")
private String outSerialId;
.....
}
XmlSerializerHelper.java
import com.thoughtworks.xstream.XStream;
public class XmlSerializerHelper implements Serialzer{
private XStream xstream;
public static <T> T deserialize(String text,Class<T> clazz){
XmlSerializerHelper xmlSerializerHelper = new XmlSerializerHelper();
return xmlSerializerHelper.deserialize(text,class,StringUtils.EMPTY);
}
@SuppressWarning("unchecked")
@Override
public <T> T deserialize(String text,Class<T> class,String dateFormat){
xstream.processAnnotations(clazz);
return (T) xstream.fromXML(text);
}
}
阅读全文
0 0
- http post xml 表单提交(application/x-www-form-urlencoded)
- python实现http post四种请求体x-www-form-urlencoded ,form-data ,json,xml
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- application/x-www-form-urlencoded
- post 请求 application/x-www-form-urlencoded。android 中文 乱码
- 提交application/x-www-form-urlencoded类型数据
- HTTP中application/x-www-form-urlencoded字符说明
- HTTP中application/x-www-form-urlencoded字符说明
- HTTP中application/x-www-form-urlencoded字符说明
- pyspark 实践汇总1
- 用virsh读xml文件启动domain时出现错误 libvirt error: cannot execute binary ......
- [RK3399][Android7.1] Uboot编译所用平台配置文件
- Geoserver图层显示乱码
- VMware + Linux + Xshell 连接
- http post xml 表单提交(application/x-www-form-urlencoded)
- 免费全网VIP视频播放软件 绿色无广告(通用)
- “未卜先知”、“自学成才”:GANs奇思妙想TOP10
- 工作总结第五天
- Linux查看物理CPU个数、核数、逻辑CPU个数
- mysql--10010概述
- GDT(全局描述符表)和LDT(局部描述符表)
- 设计模式——桥接模式
- SQL Server基础之存储过程