对方使用的环境为ASP.NET java
下载AXIS2的1.6.2包:http://axis.apache.org/axis2/java/core/download.cgi根据wsdl文件描述,使用 wsdl2java.bat 工具生成调用代码 apache
命令以下:wsdl2java.bat -uri http://xxx.xxx.xxx:xxx/Services.asmx?wsdl app
生成的两个class文件(ServicesCallbackHandler.java,ServicesStub.java)在D:/axis2-1.6.2/bin/src目录下面, 拷贝到你的项目中进行编译 工具
编译前要把D:/axis2-1.6.2/lib目录下面的包拷贝到你的项目中 测试
调用测试:public class TestCollectShowInfo{ public static String getXml(){ //该XML格式按照对方要求而生成 StringBuffer buf = new StringBuffer(); buf.append("<?xml version='1.0' encoding='UTF-8'?>"); buf.append("<root>"); buf.append("<head>"); buf.append("<requestid>11111</requestid>"); buf.append("<username>11111</username> "); buf.append("<password>11111</password>"); buf.append("</head>"); buf.append("<body>"); buf.append("<record productid=\"1002\" title=\"东莞医疗机构首现社会监督员\" url =\"www.baidu.com\" createtime =\"2008-11-12\" type=\"0\"/>"); buf.append("<record productid=\"1002\" title=\"78岁老太手术成功完全结束\" url =\"www.baidu.com\" createtime =\"2008-11-11\" type=\"1\" />"); buf.append("</body>"); buf.append("</root>"); return buf.toString(); } public static void main(String[] args){ try{ String uri = "http://xxx.xxx.xxx:xxx/Services.asmx"; ServicesStub stub = new ServicesStub(uri); CollectShowInfo info = new CollectShowInfo(); info.setXmlstr(getXml()); // xmlstr是要传给WEBSERVICE的内容.本例子传的是一个XML串 CollectShowInfoResponse response = stub.CollectShowInfo(info); System.out.println(response.getCollectShowInfoResult()); //输出返回的结果 }catch (Exception e){ e.printStackTrace(); } } }注意: CollectShowInfo及CollectShowInfoResponse两个CLASS是ServicesStub.java中的内部类.