【发布时间】:2012-12-05 11:12:41
【问题描述】:
我对 Java 非常陌生,并试图调用 Web 服务。我从网上拿了一个代码
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构建路径中添加“c:/program files/java/jdk1.6.0_18/jre/lib/rt.jar”作为外部jar解决了这个问题
标签: java web-services jar syntax-error remoteexception