中征征信java_征信接口调用,解析(xml)

数据传输格式报文格式:xmlpublic CisReportRoot queryCisReport(PyQueryBean pyQueryBean) throwsException {

CisReportRoot cisReportRoot=invokePy(pyQueryBean){

CisReportRoot cisReportRoot=queryCisReportFromPyServer(pyQueryBean);   } }

pyQueryBean--CisReportRoot

注意:接口数据传输通过xml,无论发送请求,还是获取响应都需要经过经过xml格式转化。1,CisReportRoot cisReportRoot = getCisReportRoot(doc); pyQueryBean--Map--doc--xmL

//实体转化为Map

2,Map map = CommonUtils.beanToMap(pyQueryBean);

//Map转化为指定标签的xml字符串 Map-doc-xml

3,String queryInfo = XmlUtil.createQueryCondition(map);

//从鹏元获取Xml,转化为doc xml-doc-

4,Document doc =pyClient.connectToPyClient(queryInfo);

//解析doc中数据,赋值到实体

5,CisReportRoot cisReportRoot = getCisReportRoot(doc);

具体实现如下:2,public static MapbeanToMap(Object obj) {if (obj == null) {return null;

}

Map map = new HashMap<>();try{

BeanInfo beanInfo=Introspector.getBeanInfo(obj.getClass());

PropertyDescriptor[] propertyDescriptors=beanInfo.getPropertyDescriptors();for(PropertyDescriptor property : propertyDescriptors) {

String key=property.getName();//过滤class属性

if (!"class".equals(ke

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值