如果以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/">{&quot;returncode&quot;:&quot;10006&quot;,&quot;returnmsg&quot;:&quot;未获取到交易机构信息&quot;,&quot;fpdm&quot;:&quot;null&quot;,&quot;fphm&quot;:&quot;null&quot;,&quot;kprq&quot;:&quot;null&quot;}
</validateInvoiceReturn></validateInvoiceResponse></soapenv:Body></soapenv:Envelope>

实际内容:

{&quot;returncode&quot;:&quot;10006&quot;,&quot;returnmsg&quot;:&quot;未获取到交易机构信息&quot;,&quot;fpdm&quot;:&quot;null&quot;,&quot;fphm&quot;:&quot;null&quot;,&quot;kprq&quot;:&quot;null&quot;}

参考 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/">{&quot;returncode&quot;:&quot;10006&quot;,&quot;returnmsg&quot;:&quot;未获取到交易机构信息&quot;,&quot;fpdm&quot;:&quot;null&quot;,&quot;fphm&quot;:&quot;null&quot;,&quot;kprq&quot;:&quot;null&quot;}</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>

随机推荐

  1. eclipse jee使用

    eclipse jee 安装 已经安装过elipse for Java,不知道会不会冲突? 查过,原来,你就算安装多个elipse for java都没事,更不用说jee.我选择的是eclipse-i ...

  2. yarn工具的使用

    <!-- yarn init === npm init --> <!-- yarn login === npm adduser -->登录 <!-- yarn publi ...

  3. HMM模型学习笔记(维特比算法)

    维特比算法(Viterbi) 维特比算法  编辑 维特比算法是一种动态规划算法用于寻找最有可能产生观测事件序列的-维特比路径-隐含状态序列,特别是在马尔可夫信息源上下文和隐马尔可夫模型中.术语“维特比 ...

  4. hive视图

    简化复杂的查询 员工好.姓名.月薪.年薪.在一个emp表中; 部门名称在dept的表中;并未年薪起了一个名字annlsal 查询视图 视图是一个虚表,是不存数据的

  5. CentOS常用包安装

    安装rz和sz命令: yum install lrzsz 安装unzip:yum install unzip

  6. Java DateUtils 的实用

    Java DateUtils的实用可以很方便的对日期进行对年,月,日,时,分,秒的相加和相减,能很好的解决日期的运算 可以不用必须调用Oracle等数据库本地函数进行运算,相比之下更为简洁方便. pa ...

  7. Socket网络编程--Libev库学习(1)

    这一节是安装篇. Socket网络编程不知不觉已经学了快两个月了.现在是时候找个网络库学学了.搜索了很多关于如何学网络编程的博客和问答.大致都是推荐学一个网络库,至于C++网络库有那么几个,各有各的好 ...

  8. echarts之简单的入门——【一】做个带时间轴的柱状统计图

    百度Echarts 官网首页  http://echarts.baidu.com/ 配置项手册 http://echarts.baidu.com/option.html#title GL配置项手册 h ...

  9. ef 仓储模式

    构建一个仓储模式. Model 大家自己创建就行了,上个图,就不多说了(我是code first) IDAL namespace IDAL { public interface IBaseReposi ...

  10. HDU - 1260 (Tickets)

    题意:  买票    一个人要么自己买  要么和前面的人一起买   这两种情况分别有一个买票所花费的时间  求总的花费时间最小 解析: dp[i] 表示前i个人买票总的花费时间 v[i]表示第i个人买 ...