我对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 无法解决”错误,所以请告诉如何删除这个错误