qqweede 2017-12-07 06:05 采纳率: 33.3%
浏览 3465
已结题

为什么 Service service= new Service();

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包均已经导入,很迷茫呢。等待着大神。

  • 写回答

29条回答 默认 最新

  • weixin_39957629 2017-12-07 06:12
    关注

    因为Service是一个类

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试