xfire java调用 .NET webservice 方法返回值是[#document: null]
来源:互联网 发布:数据库 怎么输入rull 编辑:程序博客网 时间:2024/06/06 08:58
问题描述:
//通过WSDL创建一个动态的客户端,调用.NET的webservice
Client client = new Client(new URL("http://some.com/service/WebService.asmx?wsdl"));
Object[] results = client.invoke("methodName", new Object[] {param1,param2,...paramN});
System.out.println(results[0]);
结果返回的是 [#document: null]
问题解决:
返回的是org.apache.xerces.dom.DocumentImpl,你也可以强制转换为w3c的document。
Document d = (Document)results[0];
这边的XML文件比较简单:
<Result xmlns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Errorcode>1</Errorcode>
<Errormsg></Errormsg>
</Result>
所以我直接获得Errorcode的值
System.out.println(d.getFirstChild().getFirstChild().getNodeName()+"::"+d.getFirstChild().getFirstChild().getTextContent());
总体的java代码如下:
当然如果是复杂的XML文件,就可以nodeList进行循环读取了。如:
NodeList nl =d.getElementsByTagName("Errorcode");
- xfire java调用 .NET webservice 方法返回值是[#document: null]
- xfire调用webservice[#document: null]问题
- Java调用Document.getElementById方法返回null的解决办法
- java调用webservice用是axis还是xfire的,两种调用方法不同。
- java调用webservice用是axis还是xfire的,两种调用方法不同
- java调用webservice XFire!
- java调用webservice XFire
- java调用webservice XFire
- xfire调用webService接口方法
- 使用java的xfire调用.net的webservice-王亮
- 使用java的xfire调用.net的webservice-王亮
- WebService java 调用 .net方法
- java调用.net webservice 返回图片
- java(xfire)调用java编写的webservice
- 求救:为什么调用System.console()方法返回的是null?
- java调用webservice XFire(转)
- java用XFire开发调用webService例子
- java用XFire开发调用webService例子
- lucene 在eclipse 中运行
- What’s the behavior when calling an overwritten virtual method in the constructor method of a base class?
- SQL Server技巧合集2005-04-2
- Quora为什么选择Python开发
- 解析三层架构(3)---三层架构中的实体类和面向对象
- xfire java调用 .NET webservice 方法返回值是[#document: null]
- poj2887
- 堆、栈和堆栈
- Web保存对话框
- 老老实实复习算法: 1 插入排序
- vb.net的String数据类型
- android如何阻止app_name在标题栏中闪现
- [转]利用Ajax实现长连接(模拟推送,半长连接)
- KMP算法java实现