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 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services