我真的是 Java 的新手,正在尝试调用网络服务。我从网上拿了一个代码
String message = "";
static Map output;
public static void main(String args[]) {
try {
String inputparam = "10000";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(""));
call.setOperationName(new QName("http://testPackage.fc.com/, doBasicStuff"));
call.addParameter("Hello", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
Object responseWS = call.invoke(new Object[] { inpurparam });
System.out.println("ReceivingResponse: " + (String) responseWS);
output = call.getOutputParams();
String firstName = (String) output.get(new QName("", "firstName"));
} catch (Exception e) {
System.err.println(e.toString());
}
}
语法错误
The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files
在线
Object responseWS = call.invoke(new Object[] { inpurparam });
所以我添加了“import java.rmi.RemoteException;”声明它给导入语句“导入 java.rmi.RemoteException 无法解析”错误,所以请告诉如何删除这个错误
最佳答案
你需要添加
导入 java.rmi.RemoteException;
在你的类声明之前
关于java - 无法解析类型 java.rmi.RemoteException。它是从 java 中必需的 .class 文件错误中间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13721982/