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 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?