使用JDK自带的命令wsimport 来解析wsdl文档

用工具wsimport生成访问webservice的客户端代码

wsimport所在位置:

C:\Program Files\Java\jdk1.8.0\bin

wsimport -d D:/webservice -keep http://192.168.1.131:8080/BillingSystem/com.mobile263.billing.webservices.service.EsWebservice?wsdl

命令参数说明:

-keep:是否生成java源文件

-d:指定输出目录

-s:指定源代码输出目录

-p:以package的形式生成文件

-verbose:在控制台显示输出信息

其他命令参数请参照: http://download-llnw.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html

调用代码:

public class TestClient {
	public static void main(String[] args) {
		EsWebserviceImplService service = new EsWebserviceImplService();
		EsWebservice  esWebservice = service.getEsWebserviceImplPort();
		StringArray sa= esWebservice.querySJList("17091234567", 20140212151617l, 20140212151690l, "SJ");
		System.out.println(sa.getItem());
	}
}

返回数据是一个字符串数组:

[{"areaCode":"010       ","roamType":"3 ","gloalRoamCost":"1234567890                      ","upperFlow":123456789012345,"downFlow":123456789012345,"billingNumber":"17091234567             ","startTime":"20140212151621","imsi":"460014890228030 ","endTime":"20140212151622"}, {"areaCode":"010       ","roamType":"0 ","gloalRoamCost":"1234567890                      ","upperFlow":123456789012345,"downFlow":123456789012345,"billingNumber":"17091234567             ","startTime":"20140212151617","imsi":"460014890228030 ","endTime":"20140212151618"}, {"areaCode":"010       ","roamType":"3 ","gloalRoamCost":"1234567890                      ","upperFlow":123456789012345,"downFlow":123456789012345,"billingNumber":"17091234567             ","startTime":"20140212151619","imsi":"460014890228030 ","endTime":"20140212151620"}]





你可能感兴趣的:(webservice)