传递对方的url,方法名,参数信息。不需要引用对方的代码。
package com.leetch.impl;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class HelloWorldServiceClient {
public static void main(String[] args) throws Exception {
Service service = new Service();
try {
Call call = (Call) service.createCall();
call .setTargetEndpointAddress("http://172.16.192.73:8080/np-fy-ajpc/services/ajpcTjpcService?wsdl");
call.setOperationName("tjpcProcess");
call.addParameter(
"xmlParam", //设置要传递的参数
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
// call.setTimeout(5000);
call.setUseSOAPAction(true);
call
.setSOAPActionURI("http://support.ajpc.fy.np.thunisoft.com/tjpcProcess");
String result = (String) call
.invoke(new Object[] { "<QueryParam NAjlb='1' NSpcx='2' CBhAj='6A10F8068A8015310BA2887DEFFC8960' NSyfy='1'></QueryParam>" });
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
测试跑通了