1、导jar包
<!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
wsCaller访问图:
String url = "http://xxx.xxx.xxx.xxx:8080/axis2/services/XXXXX?wsdl";
String uurl = "http://webservice.XXX.com";
String strXml ="XXX"
Service service = new Service();
Call call =(Call) service.createCall();
call.setTargetEndpointAddress(new URL(url));
call.setOperationName(new QName(uurl, "toDadaWS")); // WSDL里面描述的接口名称
call.addParameter("xmlStr", XMLType.XSD_STRING, ParameterMode.IN); // 接口的参数类型
call.setEncodingStyle("UTF-8");
call.setReturnType(XMLType.XSD_STRING); // 设置返回值类型
String result =(String) call.invoke(new Object[]{strXml}); //传入参数并返回返回值