假设axis的文件夹路径为:D:/project/axis-1_4
在这个目录根目录下放需要生成java的wsdl文件,然后建立一个xxx.bat文件,内容如下:
set AXIS_HOME=D:/project/axis-1_4
set CLASSPATH=,;%AXIS_HOME%/lib/axis.jar;%AXIS_HOME%/lib/axis-ant.jar;%AXIS_HOME%/lib/commons-discovery-0.2.jar;%AXIS_HOME%/lib/commons-logging-1.0.4.jar;%AXIS_HOME%/lib/jaxrpc.jar;%AXIS_HOME%/lib/log4j-1.2.8.jar;%AXIS_HOME%/lib/saaj.jar;%AXIS_HOME%/lib/wsdl4j-1.5.1.jar;%AXIS_HOME%/lib/mail.jar;
java org.apache.axis.wsdl.WSDL2Java -p com.tf.mpltcc360.wsxc GetData.wsdl
备注:”com.tf.mpltcc360.wsxc”代表生成的代码的包目录结构,生成的文件会在D:/project/axis-1_4目录下
“GetData.wsdl”为wsdl文件名,当然这里也可以写上http://xxx/xxx?wsdl
代码调用方式:
xxxLocator servince = new xxxLocator();
xxxSoap_PortType client = servince.getxxxSoap();
String xmlDoc = client.getxxxx("xxxx");//此处为ws提供的方法
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/java/282501.html