如果以GET或POST请求某个系统返回,带有 $#x 那很有可能是axis服务器返回的.
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><validateInvoiceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><validateInvoiceReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">{"returncode":"10006","returnmsg":"未获取到交易机构信息","fpdm":"null","fphm":"null","kprq":"null"}
</validateInvoiceReturn></validateInvoiceResponse></soapenv:Body></soapenv:Envelope>
实际内容:
{"returncode":"10006","returnmsg":"未获取到交易机构信息","fpdm":"null","fphm":"null","kprq":"null"}
参考 http://www.iteye.com/problems/73011
$$$$$ 使用dom4j可解析它
public static void main(String[] args) throws Exception {
String retXml = readStringFromFile("d://a.txt","GBK");//你刚得到的返回报文 Document document = DocumentHelper.parseText(retXml); OutputFormat format = OutputFormat.createPrettyPrint();
StringWriter sw = new StringWriter();
XMLWriter xw = new XMLWriter(sw, format);
xw.setEscapeText(false);
xw.write(document);
xw.flush(); String finalRetXml = sw.toString();
System.out.println("最终返回报文:\n"+finalRetXml);
}
最终得到:
文件 d://a.txt存在与否?: true
读到的文件内容如下:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><validateInvoiceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><validateInvoiceReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">{"returncode":"10006","returnmsg":"未获取到交易机构信息","fpdm":"null","fphm":"null","kprq":"null"}</validateInvoiceReturn></validateInvoiceResponse></soapenv:Body></soapenv:Envelope>
最终返回报文:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<validateInvoiceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<validateInvoiceReturn xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">{"returncode":"10006","returnmsg":"未获取到交易机构信息","fpdm":"null","fphm":"null","kprq":"null"}</validateInvoiceReturn>
</validateInvoiceResponse>
</soapenv:Body>
</soapenv:Envelope>
随机推荐
-
size_t 类型
1 关于size_t定义 size_t是一种数据相关的无符号类型,它被设计得足够大以便能够内存中任意对象的大小.在cstddef头文件中定义了size_t类型,这个文件是C标准库stddef.h头文件 ...
-
js实现A*寻路算法
这两天在做百度前端技术学院的题目,其中有涉及到寻路相关的,于是就找来相关博客进行阅读. 看了Create Chen写的理解A*寻路算法具体过程之后,我很快就理解A*算法的原理.不得不说作者写的很好,通 ...
-
RecursiveDirectoryIterator目录操作类
/** * @author Funsion Wu * @abstract SPL使用案例,全国首发,技术分享,欢迎转帖 */ class Dir extends RecursiveDirectoryI ...
-
模拟电路";虚短"; &; ";虚断";
<虚短 & 虚断> 运算放大器组成的电路五花八门,令人眼花瞭乱,是模拟电路中学习的重点.遍观所有模拟电子技朮的书籍和课程,在介绍运算放大器电路的时候,无非是先给电路来个定性,比如这 ...
-
mysql Event、存储过程、表命令
Mysql事件调度器(Event Scheduler)类似于定时器,可以在某一个时间点执行一个SQL语句或一个语句块(BEGIN ... END):或者每隔固定间隔重复执行.类似于Linux下的cro ...
-
1474 十进制转m进制
1474 十进制转m进制 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题解 题目描述 Description 将十进制数n转换成m进制数 m ...
-
DFS----Lake Counting (poj 2386)
Lake Counting(POJ No.2386) Description Due to recent rains, water has pooled in various places in Fa ...
-
java降低竞争锁的一些方法
序本文介绍一下提升并发可伸缩性的一些方式:减少锁的持有时间,降低锁的粒度,锁分段.避免热点域以及采用非独占的锁或非阻塞锁来代替独占锁. 减少锁的持有时间降低发生竞争可能性的一种有效方式就是尽可能缩短锁 ...
-
浮动float 摆放位置
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
-
golang闭包实现递归
func main() { for i := 1; i < 30; i++ { fmt.Println(Fibonacci(i)) } } func Fibonacci(n int) int { ...