package com.util;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class WebServiceClient {
public static String test(String key,String jsonMsg,String endpoint,String orgid,String type) throws ServiceException, MalformedURLException, RemoteException {
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName("revInsuranceData");
call.setUseSOAPAction(true);
String res = (String) call.invoke(new Object[] { id1,type });
decryptStr = eu.getDecryptStr(key, res);
System.out.println(decryptStr);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return decryptStr;
}
public static void main(String[] args) throws Exception {
test( key, jsonMsg, endpoint, orgid, type);
}
}
使用main测试的时候是没有问题的,当放在tomact下,通过方法调用,就会在Service service = new Service()处卡主,使用try/catch捕获异常,会看到java.lang.reflect.InvocationTargetException,但在控制台并不输出这个错误,各个jar包均已经导入,很迷茫呢。等待着大神。