前端使用webservice传递数据
-
需要借助到 X2JS 插件、npm下载
-
然后需要使用require引入
-
使用new函数创建一个x2js的实例
-
然后使用实例对象里面的方法进行json和xml的互相转换
转换规则:(
let obj = { uploadOpenMessage:{ _xmlns:'http://webservice.gunark.bjut.com/', arg0:{_xmlns:"",__text:'192.168.2.157'}, arg1:{_xmlns:"",__text:'192.168.2.157'}, arg2:{_xmlns:"",__text:'192.168.2.157'}, arg3:{_xmlns:"",__text:'192.168.2.157'}, arg4:{_xmlns:"",__text:'2020-08-19T09:20:58.6687235+08:00'}, arg5:{_xmlns:"",__text:'1'}, } }
json对象转xml
1、最外围的uploadOpenMessage是xml的最外层标签、单下划线 "" 是添加标签的属性、 双下划线 " _ "是添加标签的内容
)